R
Railway•16mo ago
meijin

Unable to access the Postgres database only from my App but can access from local machine

I'm seeking assistance regarding connectivity issues with a Postgres database. When deploying my application, as well as while it's in operation, I'm unable to access the Postgres database. However, I can access it from my local DB client using the same DATABASE_URL. The project ID is a4502355-3a2e-4b1a-8423-538dbf6e55ec. During the application's deployment, I attempt to execute a migrate using Prisma, but I'm encountering the following error, which halts the process: Error: P1001: Can't reach database server at containers-us-west-XXXX.railway.app:XXXX. The operating application also stops, which I suspect is due to the same issue (as the API times out). The application refers to the environment variable DATABASE_URL, which is set as ${{Postgres.DATABASE_URL}}. The issue started around 13:00 JST on June 2, as I received inquiries from service users around that time. Interestingly, I can successfully connect to the database when using the TablePlus client, which leads me to believe the DB is functioning normally. Yet, even if I copy the connection info from TablePlus and set it to the DATABASE_URL in the application's Environment Variables, and redeploy, the same error occurs. Based on these findings, it appears the DB is functioning normally, but for some reason, it's become inaccessible from the application server (and the deployment environment). Could it be due to some sort of network migration? Could you please guide me on how to handle this situation?
78 Replies
Percy
Percy•16mo ago
Project ID: a4502355-3a2e-4b1a-8423-538dbf6e55ec
Brody
Brody•16mo ago
you can always try a good old restart, the restart button is in the plugin settings just a quick question too, did you recently upgrade to the dev plan?
meijin
meijin•16mo ago
OK, I'll try restart plugin. No, I had upgraded to the dev plan over 1 year ago.
Brody
Brody•16mo ago
okay cool
meijin
meijin•16mo ago
Is it that you said?
Brody
Brody•16mo ago
yes
meijin
meijin•16mo ago
I restarted postgres plugin, but redeploy still failed... And my App still stopped.
Brody
Brody•16mo ago
did it fail during build or during deployment
meijin
meijin•16mo ago
Maybe during build. Here is part of Build Logs that shows 'error command failed' (and hidden the real hostname)
meijin
meijin•16mo ago
There is additional log.
Brody
Brody•16mo ago
show me the table at the very top of the build please no cropped screenshots again
meijin
meijin•16mo ago
It is top of the build. Correct?
Brody
Brody•16mo ago
oh dockerfile would have been helpful to know that before hand lol please send your dockerfile
meijin
meijin•16mo ago
OMG. Here is my dockerfile!
FROM node:lts

RUN mkdir /src
RUN mkdir -p /src/server/credentials

ARG PORT
ARG API_SERVER_PORT
ARG API_BASE_PATH
ARG DATABASE_URL
ARG FIREBASE_CREDENTIAL_BASE64
ARG GOOGLE_APPLICATION_CREDENTIALS

WORKDIR /src

COPY . .
RUN yarn install --cwd server

RUN echo $FIREBASE_CREDENTIAL_BASE64 | base64 -di > ./server/credentials/firebase-adminsdk-credentials.json
RUN yarn run build:server

EXPOSE 80
CMD yarn run start:server
FROM node:lts

RUN mkdir /src
RUN mkdir -p /src/server/credentials

ARG PORT
ARG API_SERVER_PORT
ARG API_BASE_PATH
ARG DATABASE_URL
ARG FIREBASE_CREDENTIAL_BASE64
ARG GOOGLE_APPLICATION_CREDENTIALS

WORKDIR /src

COPY . .
RUN yarn install --cwd server

RUN echo $FIREBASE_CREDENTIAL_BASE64 | base64 -di > ./server/credentials/firebase-adminsdk-credentials.json
RUN yarn run build:server

EXPOSE 80
CMD yarn run start:server
Brody
Brody•16mo ago
I think I see the problem, what kind of app is this again though
Want results from more Discord servers?
Add your server