Node/Prisma app failing to deploy

My process:

  1. Fly postgres create
  2. Fly launch
  3. Setup secrets
  4. Fly deploy

Upon deploying I am getting the following errors:

prisma:warn Prisma failed to detect the libssl/openssl version to use, and may not work as expected. Defaulting to “openssl-1.1.x”.

Please manually install OpenSSL via apt-get update -y && apt-get install -y openssl and try installing Prisma again. If you’re running Prisma on Docker, add this command to your Dockerfile, or switch to an image that already has OpenSSL installed.

Error: Migration engine error:
/app/docker-entrypoint.js:24
reject(new Error(${command} failed rc=${code}))
^
Error: npx prisma migrate deploy failed rc=1
at ChildProcess. (/app/docker-entrypoint.js:24:16)
at ChildProcess.emit (node:events:513:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
Node.js v18.16.0

I’ve never had this issue in the past. Can someone please help?

Thanks.

1 Like

Hello,

I’m not very familiar with Prisma, and while I didn’t follow your exact process here I hope I can help. What I did:

  1. Checked out GitHub - prisma/prisma-examples: 🚀 Ready-to-run Prisma example projects to quickly find an example project to run.
  2. cd prisma-examples/javascript/rest-express
  3. fly launch

flyctl automatically detects a Prisma app and creates a Dockerfile/entrypoint. It defaults to using sqlite but Postgres can of course be added.

The key point is that a Dockerfile is generated and seems to derive from a Debian base. Does your setup also include a Dockerfile? You should be able to just add the necessary dependency alongside the ones we already install.

Let me know if you’d like the Docker/fly.toml configs that were generated for the sample app and I can include them.

Thank you for your reply.

My setup does include a Dockerfile. Unfortunately, adding something like RUN apt-get update -y && apt-get install -y openssl does not solve the issue.

Please share your config files and I’ll try using those and see what happens.

I’m sorry that I didn’t actually try deploying this, because I’m getting this error as well with our own generated Dockerfile.

Let me try a few ideas and get back to you when I have something.

Thank you. I’m glad to hear that this issue is not only on my end - was on the verge of pulling my hair out.

Please shout if you figure it out. I’d really appreciate it.

Good news for you and your hair, I believe I cracked it. Full disclosure that my test app still isn’t deploying but that’s likely due to us generating an entrypoint that expects npm run to work but this sample doesn’t have a run script. Here’s the Dockerfile I’m using:

# syntax = docker/dockerfile:1

# Adjust NODE_VERSION as desired
ARG NODE_VERSION=18.16.0
FROM node:${NODE_VERSION}-slim as base

LABEL fly_launch_runtime="NodeJS/Prisma"

# NodeJS/Prisma app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV=production


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build node modules
RUN apt-get update -qq && \
    apt-get install -y python-is-python3 pkg-config build-essential openssl

# Install node modules
COPY --link package.json .
RUN npm install --production=false

# Generate Prisma Client
COPY --link prisma .
RUN npx prisma generate

# Copy application code
COPY --link . .

# Remove development dependencies
RUN npm prune --production


# Final stage for app image
FROM base

RUN apt-get update -qq && \
    apt-get install -y openssl

# Copy built application
COPY --from=build /app /app

# Entrypoint prepares the database.
ENTRYPOINT ["/app/docker-entrypoint"]

# Start the server by default, this can be overwritten at runtime
CMD [ "npm", "run", "start" ]

The bit I added was this:

# Final stage for app image
FROM base

# Specifically this:
RUN apt-get update -qq && \
    apt-get install -y openssl

Not sure what your Dockerfile was, but in our case we weren’t installing openssl in the final image. I’ll see if I can get that fixed.

Let me know if that works for you.

1 Like

Thank you. I copied your Dockerfile which seems to have fixed the original error. I am now however getting a different error:

In my terminal:
WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:

  • 0.0.0.0:3000
    Found these processes inside the machine with open listening sockets:
    PROCESS | ADDRESSES
    -----------------*---------------------------------------
    /.fly/hallpass | [fdaa:1:191:a7b:d6e9:4a80:ccea:2]:22

Fly monitoring:
Error: P1011: Error opening a TLS connection: unexpected EOF
Error: npx prisma migrate deploy failed rc=1

I am certain that my app is listening on 0.0.0.0:3000.

What’s in your fly.toml? Check that your HTTP listener isn’t set to port 8080, which I believe we generally default to. Sorry I don’t know the syntax off-hand, but I got this one as well and it turned out the ports didn’t match. Either listen on 8080 or change the config to reference 3000 and you should be good to go.

fly.toml was also set to 3000. Changed everything to 8080 now because that worked for me in the past too but unfortunately still getting the same errors. I suspect these errors are as a result of recent updates to the fly CLI - I updated from 1.2.X to 1.3.9 this morning and since then I haven’t been able to deploy an app successfully. Any thoughts?

Aww, bummer, figured it couldn’t be that easy.

I’ll take a look tomorrow morning, but if at all possible, it might be
wise to update to the latest flyctl and delete/re-create the app,
backing up your existing Dockerfile/fly.toml just in case. I did get a
fix for the broken Dockerfile upstreamed so with any luck it’ll just
work immediately for you this time around.

Still no luck on my end :frowning:

I just saw a new post from a user claiming that his psql db is inaccessible: https://community.fly.io/t/postgres-inaccessible-from-application/13694?u=mahomed

Wonder if it’s related?

Please let me know if you figure it out in the morning

I followed the instructions on this post and changed ‘.flycast’ to ‘.internal’ in the url to my psql db and that seems to have fixed it. App is running :+1:

1 Like

Awesome, glad you were able to figure it out, especially since I just deployed a stock Node app and wasn’t able to replicate this. :relieved:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.