Trouble getting database configured correctly
amycommits
HOBBYOP

a year ago

I am using a nuxt application with Postgres. I have connected and linked it via my terminal.

when my knexfile.cjs file looks like this (which, this is the same format of a different project I had with railway a few years ago that worked at the time):

module.exports = {
client: 'pg',
useNullAsDefault: true,
connection: {
database: process.env.NODEENV === 'development' ? 'yieldmight' : 'railway', user: 'postgres', password: process.env.PGPASSWORD, schema: 'myschema'
},
migrations: {
directory: './server/db/migrations'
},
seeds: {
directory: './server/db/seeds'
}
}

I get this error:
connect ECONNREFUSED ::1:5432

Error: connect ECONNREFUSED ::1:5432

at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)

container event container died

when my knexfile.cjs looks like:

module.exports = {
client: 'pg',
useNullAsDefault: true,
connection: process.env.DATABASE_URL,
migrations: {
directory: './server/db/migrations'
},
seeds: {
directory: './server/db/seeds'
}
}

this is my error:

connect ECONNREFUSED ::1:5432

Error: connect ECONNREFUSED ::1:5432

at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)

Stopping Container

railway run knex migrate:latest --knexfile ./knexfile.cjs --env production

command, but I think that there might be a limitation to that (?)

and I get this error:

getaddrinfo ENOTFOUND postgres.railway.internal
Error: getaddrinfo ENOTFOUND postgres.railway.internal
at GetAddrInfoReqWrap.onlookup as oncomplete

or this error when it is just the database_URL:

knex --knexfile knexfile.cjs migrate:latest

connect ECONNREFUSED fd12:773c:a1e9::43:6782:76c5:5432
Error: connect ECONNREFUSED fd12:773c:a1e9::43:6782:76c5:5432
at TCPConnectWrap.afterConnect as oncomplete
container event container died

I just tried running it with the public database url defined in the knexfile.cjs but that, unsurprisingly, also failed:

read ECONNRESET
Error: read ECONNRESET
at TCP.onStreamRead (node:internal/streambasecommons:217:20)
container event container restart
container event container died
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/503a9307-4c6e-47c3-b138-ea61354af541/vol_x7g204p4yq8ixce7
npm WARN config production Use --omit=dev instead.

all of the variables are on display when I do railway variables, but I haven't manually added any variables yet

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

View Deploy details

ⓘ Deployment information is only viewable by project members and Railway employees.

1 Replies

a year ago

Hello, It looks like you have since got it working? what was the problem?


Loading...