Unable to connect to pgvector.railway.internal
suryapratap-r
HOBBYOP

a year ago

Hi
I am unable to connect with my pgvector postgres db.

receiving the following error
getaddrinfo ENOTFOUND pgvector.railway.internal

for my sveltekit app (using dockerfile) I added 3 second sleep.
and for both pgvector and sveltekit added ENABLEALPINEPRIVATE_NETWORKING=true in variables

sveltekit app project id 94b0bba1-afce-4b74-ac49-8aa1fb06163e
pgvector project id 171d055d-0855-415c-8f03-8b52fb322141

23 Replies

a year ago

do you get that error locally?


suryapratap-r
HOBBYOP

a year ago

no, for local I am using external url for db


suryapratap-r
HOBBYOP

a year ago

so did not got this error


suryapratap-r
HOBBYOP

a year ago

postgresql://postgres:PASSWORD@pgvector.railway.internal:45850/railway
this is my connection string if its of any help. I have replaced actual password with PASSWORD

the following connection string is working
postgresql://postgres:PASSWORD@autorack.proxy.rlwy.net:45850/railway


suryapratap-r
HOBBYOP

a year ago

locally internal networking is not working

1295237203278041000


a year ago

you are using the private url locally, you need to use the public url


suryapratap-r
HOBBYOP

a year ago

using public url locally


suryapratap-r
HOBBYOP

a year ago

the issue I am facing is for the one hosted on railway


suryapratap-r
HOBBYOP

a year ago

using internal url


suryapratap-r
HOBBYOP

a year ago

please check this healthcheck endpoint
https://betterfaq-production.up.railway.app/healthz


suryapratap-r
HOBBYOP

a year ago

// src/routes/healthz/+server.js
import { sql } from '$lib/server/db/client';
import { json } from '@sveltejs/kit';

export async function GET() {
    try {
        await sql`SELECT 1'`;
        return json({ status: 'OK' }, { status: 200 });
    } catch (error) {
        // Check if the error is an instance of Error
        const errorMessage = error instanceof Error ? error.message : 'Unknown error';
        return json({ status: 'Service Unavailable', error: errorMessage }, { status: 503 });
    }
}

code for healthcheck endpoint which only checks if db is connected or not


suryapratap-r
HOBBYOP

a year ago

===
just to reiterate, using internal for connecting the application hosted on railway and db is also hosted on railway


a year ago

may i ask why you showed a screenshot of you attempting to connect to the private url locally?


suryapratap-r
HOBBYOP

a year ago

do you get that error locally?

I mentioned that both are hosted on railway, because you asked this.
sorry, english is not my first language


a year ago

your database and app are in different projects right? if so, they need to be in the same project


suryapratap-r
HOBBYOP

a year ago

yes, they are different projects.

any way to combine those?


a year ago

it would be a manual process


suryapratap-r
HOBBYOP

a year ago

thanks, I'll look it up


a year ago

look what up?


suryapratap-r
HOBBYOP

a year ago

how to do this


a year ago

you already have, just do it in the correct project this time


suryapratap-r
HOBBYOP

a year ago

got it, thanks


a year ago

for the future, please read this docs page -


Loading...