5 months ago
When we deploy again, without changing code, on the deployed service, it can't connect to prisma anymore.
Running locally from the same code and dockerfile, there is no issue
```Datasource "db": PostgreSQL database "railway", schema "public" at "postgres.railway.internal:5432"
Error: P1001: Can't reach database server at postgres.railway.internal:5432
Please make sure your database server is running at postgres.railway.internal:5432
.```
Using public connection for DB doesn't change.
Dockerfile:
# Use a specific version of the Node.js base image
FROM node:18-slim as builder
# Install openssl
RUN apt-get update && apt-get install -y openssl
# Create app directory
WORKDIR /usr/src/app
RUN ln -s /usr/lib/libssl.so.3 /lib/libssl.so.3
# Copy package.json and package-lock.json
COPY package*.json ./
# Install production dependencies only
RUN npm install
# Copy the rest of the application code
COPY . .
RUN npm run build
# Generate Prisma client
RUN npx prisma generate
# --- Production image ---
FROM node:18-slim
# Install openssl
RUN apt-get update && apt-get install -y openssl
# Create app directory
WORKDIR /usr/src/app
RUN ln -s /usr/lib/libssl.so.3 /lib/libssl.so.3
# Copy only the necessary files from the builder stage
COPY --from=builder /usr/src/app /usr/src/app
ENV NODE_ENV=production
# Run Prisma migrations before starting the application
CMD ["sh", "-c", "npx prisma migrate deploy && node dist/index.js"]
Previously used alpine, changed to node:18-slim,
Worked for a few days, deployed (without changing anything related), and the issue started happening again.
Also used debian:bullseye instead, still not working
Rolling back to previous deploy works
Could anyone help?
Related to previous thread: https://help.railway.com/questions/prisma-suddenly-crashes-on-today-s-deplo-1d3c525f
Project ID: 6bd43efc-3425-4163-bbce-f4a714622bd9
0 Replies
5 months ago
Awesome, glad you got it working
For context, legacy builder doesn't support private network during build
5 months ago
!s
Status changed to Solved dev • 5 months ago