Vapor (Swift) Postgres connection failure
I have a Swift Vapor project that I'm trying to set up on Railway. I've tried to connect using both
DATABASE_PRIVATE_URL
and DATABASE_URL
, but both are failing at the deploy stage with SSL handshake errors.
The project is working on Heroku, but I'd hoped to migrate over to Railway. Is there some other config that I've missed?
969baf4b-c7d4-413b-bcc3-c69b178b845017 Replies
Project ID:
969baf4b-c7d4-413b-bcc3-c69b178b8450
Just a quick follow-up to this, I can run the Vapor project against the Railway database in my local dev environment with the following config:
On Railway I've attempted to deploy the Vapor project with the following configs:
and
and both crash on deploy with the
CERTIFICATE_VERIFY_FAILED
error above.use the private network and disable certificate verification
Thanks @Brody, I've tried on ports 5432 and
${{Postgres.PGPORT}}
(16604) and both crash with a socket address error.
Here are the error details from https://github.com/apple/swift-nio/blob/f4c61cfdb7b2322935f242f0c292e6bd7e08c53f/Sources/NIOCore/SocketAddresses.swift#L57-L67:
GitHub
swift-nio/Sources/NIOCore/SocketAddresses.swift at f4c61cfdb7b23229...
Event-driven network application framework for high performance protocol servers & clients, non-blocking. - apple/swift-nio
you seem to be using just
${{RAILWAY_PRIVATE_DOMAIN}}
without a namespace this references the apps own private domain, not the postgres private domainWith the namespace it would be the following?
I deployed with these vars but still got a socket address error:
I also tried with
DATABASE_PORT=${{Postgres.PGPORT}}
but same result.
Is ${{Postgres.RAILWAY_PRIVATE_DOMAIN}}
correct, or is there another Postgres variable I should use?
Thanks againthat's correct, but just to be clear, you aren't modifying any variables on the postgres service itself right?
Right, I haven't modified the Postgres service variables.
and these condition attempts are done on railway, with tls disabled?
Yes, that's correct
does this database client have difficulties with ipv6? the internal network is ipv6 only
there's also an empty array where there should be connection errors, so there not much for me to go off of
can you connect to the database locally through the public tcp proxy with software like dbgate?
Not sure about difficulties w/ ipv6. I can do some research. I was able to connect locally to the Postgres service on Railway yesterday using:
are you providing a Dockerfile?
Yes, it's the standard one when you start a new Vapor project.
hmmm well I'm out of ideas at the moment, the error doesn't actually contain any reason for the error
Okay, I will dig into the Vapor code and see what I can discover there. Thank you again for your help.