Node.js connection issue
obviouslyiam
PROOP

a month ago

Unable to connect from a Node.js service to PostgreSQL database within the same Railway project. All connection attempts time out.

When my Node.js app tries to connect to the PostgreSQL database, all connections time out after ~10-15 seconds.

## Error Messages

```

x emoji PostgreSQL connection failed: Connection timeout

PostgreSQL query error: timeout exceeded when trying to connect

PostgreSQL query error: Connection terminated due to connection timeout

## Observations

- The PostgreSQL service shows status: SUCCESS and is running

- The same app connects successfully to Supabase PostgreSQL (external)

- Solana RPC, Telegram API, and other external services connect fine

- Only the Railway PostgreSQL connection fails

## App Logs (Startup)

```

elephant emoji Using Railway PostgreSQL (DATABASE_URL detected)

wrench emoji PostgreSQL Configuration:

DATABASE_URL: white_check_mark emoji Set

Connection type: Internal (no SSL)

mag emoji Testing PostgreSQL connection...

x emoji PostgreSQL connection failed: Connection timeout

## Questions

1. Is there additional configuration needed to enable private networking between services?

2. Are there known issues with PostgreSQL proxy connections?

3. Should I be using a different connection approach?

## Environment

- Node.js v24.x

- pg (node-postgres) package

- Railway Pro plan

Thank you for any assistance!

0 Replies

Loading...