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

2 years 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 ENABLE_ALPINE_PRIVATE_NETWORKING=true in variables

sveltekit app project id 94b0bba1-afce-4b74-ac49-8aa1fb06163e

pgvector project id 171d055d-0855-415c-8f03-8b52fb322141

Closed

23 Replies

2 years ago

do you get that error locally?


suryapratap-r
HOBBYOP

2 years ago

no, for local I am using external url for db


suryapratap-r
HOBBYOP

2 years ago

so did not got this error


suryapratap-r
HOBBYOP

2 years 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

2 years ago

locally internal networking is not working

1295237203278041179


2 years ago

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


suryapratap-r
HOBBYOP

2 years ago

using public url locally


suryapratap-r
HOBBYOP

2 years ago

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


suryapratap-r
HOBBYOP

2 years ago

using internal url


suryapratap-r
HOBBYOP

2 years ago

please check this healthcheck endpoint

https://betterfaq-production.up.railway.app/healthz


suryapratap-r
HOBBYOP

2 years 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

2 years ago

===

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


2 years ago

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


suryapratap-r
HOBBYOP

2 years 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


2 years ago

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


suryapratap-r
HOBBYOP

2 years ago

yes, they are different projects.

any way to combine those?


2 years ago

it would be a manual process


suryapratap-r
HOBBYOP

2 years ago

thanks, I'll look it up


2 years ago

look what up?


suryapratap-r
HOBBYOP

2 years ago

how to do this


2 years ago

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


suryapratap-r
HOBBYOP

2 years ago

got it, thanks


2 years ago

for the future, please read this docs page -


Welcome!

Sign in to your Railway account to join the conversation.

Loading...