How do I connect to one service to another using the internal network?

davehowsonPRO

3 months ago

I'm trying to connect from my Astro application to my Next server via the internal network through network variables, but I keep getting
Failed to parse URL from kingdom-events.railway.internal/api/attendees
ERR_INVALID_URL

Is there anything I'm missing?

Solved

6 Replies

davehowsonPRO

3 months ago

This is how I have specified my ENV variable
${{kingdom-events.RAILWAY_PRIVATE_DOMAIN}}/api


3 months ago

Heya, it seems you're just missing the https:// in your env var. You could make it work like so: https://${{kingdom-events.RAILWAY_PRIVATE_DOMAIN}}/api . RAILWAY_PRIVATE_DOMAIN only gives you the domain w/o any protocol (so not a URL).

hope this helps !

Best,

Nico


Status changed to Awaiting User Response railway[bot] 3 months ago


itsrems

Heya, it seems you're just missing the https:// in your env var. You could make it work like so: https://${{kingdom-events.RAILWAY_PRIVATE_DOMAIN}}/api . RAILWAY_PRIVATE_DOMAIN only gives you the domain w/o any protocol (so not a URL).hope this helps !Best,Nico

davehowsonPRO

3 months ago

Makes sense. But when I changed it to https://${{kingdom-events.RAILWAY_PRIVATE_DOMAIN}}/api

I get

cause: Error: connect ECONNREFUSED fd12:[redacted]:443

Jan 28 09:12:41

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

Jan 28 09:12:41

at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:128:17) {

Jan 28 09:12:41

errno: -111,

Jan 28 09:12:41

code: 'ECONNREFUSED',

Jan 28 09:12:41

syscall: 'connect',

Jan 28 09:12:41

address: 'fd12:[redacted]:ffd6',

Jan 28 09:12:41

port: 443


Status changed to Awaiting Railway Response railway[bot] 3 months ago


davehowson

Makes sense. But when I changed it to https://${{kingdom-events.RAILWAY_PRIVATE_DOMAIN}}/apiI getcause: Error: connect ECONNREFUSED fd12:[redacted]:443Jan 28 09:12:41at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)Jan 28 09:12:41at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:128:17) {Jan 28 09:12:41errno: -111,Jan 28 09:12:41code: 'ECONNREFUSED',Jan 28 09:12:41syscall: 'connect',Jan 28 09:12:41address: 'fd12:[redacted]:ffd6',Jan 28 09:12:41port: 443

davehowsonPRO

3 months ago

I changed my next projects start script to this following docs as well

next start --hostname :: --port ${PORT-3000}"

But still getting connection refused


davehowson

I changed my next projects start script to this following docs as wellnext start --hostname :: --port ${PORT-3000}"But still getting connection refused

davehowsonPRO

3 months ago

Not sure if I should specify the port in my FE, but I did so
https://${{kingdom-events.RAILWAY_PRIVATE_DOMAIN}}:8080/api

and now I get

cause: [Error: 40EC5784F77F0000:error:0A0000C6:SSL routines:tls_get_more_records:packet length too long:ssl/record/methods/tls_common.c:662:

Jan 28 09:41:06

] {

Jan 28 09:41:06

library: 'SSL routines',

Jan 28 09:41:06

reason: 'packet length too long',

Jan 28 09:41:06

code: 'ERR_SSL_PACKET_LENGTH_TOO_LONG'

Jan 28 09:41:06

}


davehowsonPRO

3 months ago

Removed https and it works

http://${{kingdom-events.RAILWAY_PRIVATE_DOMAIN}}:8080/api - is the right way. Thank you


Status changed to Solved brody 3 months ago


How do I connect to one service to another using the internal network? - Railway Help Station