Postgres database configuration issues

amycommits
HOBBY

10 months ago

I am building my first project in a while. When I look at my variables I have:

DATABASE_URL: postgresql://postgres:EpPKoCiTMJhfWsuDiwYTPMtqVSzpCRwD@postgres.railway.internal:5432/railway

but I keep running into an issue like this:

{
databaseUrl: 'postgresql://postgres:EpPKoCiTMJhfWsuDiwYTPMtqVSzpCRwD@postgres.railway.internal:5432/railway'
}
Using environment: production
getaddrinfo ENOTFOUND postgres.railway.internal
Error: getaddrinfo ENOTFOUND postgres.railway.internal
at GetAddrInfoReqWrap.onlookup as oncomplete

✗ railway run ping postgresql://postgres:EpPKoCiTMJhfWsuDiwYTPMtqVSzpCRwD@postgres.railway.internal:5432/railway

ping: cannot resolve postgresql://postgres:EpPKoCiTMJhfWsuDiwYTPMtqVSzpCRwD@postgres.railway.internal:5432/railway: Unknown host

what can I do to get the postgres instance connected?

0 Replies

amycommits
HOBBY

10 months ago

project id: 90fe61f2-e607-4d1c-b46e-c464d225b530/


10 months ago

locally you must use the public host and port.

please know that railway run, runs the command locally.


amycommits
HOBBY

10 months ago

Would there be an issue if I accidentally did rails up when linked to the postgres server?


10 months ago

only a temporary issue, you would need to redeploy the database image from the deployment's 3-dot menu


10 months ago

you wouldn't lose any data


amycommits
HOBBY

10 months ago

that could be a part of my issue, thank you


amycommits
HOBBY

10 months ago

well, the initial migration hasn't even run yet


amycommits
HOBBY

10 months ago

Thank you! I didn't realize that's how railway link worked


10 months ago

no problem!


amycommits
HOBBY

10 months ago

While I have your attention: is there a reason why I would get a 500 error for my internal api calls?

Listening on http://[::]:8080

error: select distinct on ("f"."ticker") "fd".*, "f"."ticker", "f"."name", "f"."company", "f"."site", "f"."distribution_frequency", "f"."underlying",

      (

    ) AS avg_all_time from "fund_distributions" as "fd" inner join "funds" as "f" on "fd"."fund_id" = "f"."id" where [fd.next](fd.next)_declaration_date_on = (SELECT MAX(next_declaration_date_on) FROM fund_distributions WHERE fund_id = [fd.fund](fd.fund)_id) - relation "fund_distributions" does not exist

at Parser.parseErrorMessage (/app/.output/server/node_modules/pg-protocol/dist/parser.js:283:98)

at Parser.handlePacket (/app/.output/server/node_modules/pg-protocol/dist/parser.js:122:29)

at Parser.parse (/app/.output/server/node_modules/pg-protocol/dist/parser.js:35:38)

at Socket. (/app/.output/server/node_modules/pg-protocol/dist/index.js:11:42)

at Socket.emit (node:events:517:28)

at addChunk (node:internal/streams/readable:368:12)

at readableAddChunk (node:internal/streams/readable:341:9)

at Readable.push (node:internal/streams/readable:278:10)

at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {

length: 119,

severity: 'ERROR',

code: '42P01',

detail: undefined,

hint: undefined,

position: '2478',

internalPosition: undefined,

internalQuery: undefined,

where: undefined,

schema: undefined,

table: undefined,

column: undefined,

dataType: undefined,

constraint: undefined,

file: 'parse_relation.c',

line: '1449',

routine: 'parserOpenTable'

}


amycommits
HOBBY

10 months ago

At least the table exists in my Postgres instance now 😅


10 months ago

fund_distrobutions does not exist