3 months ago
Hi Railway,
I'm unable to make my service (call it webApp) communicate with another (Bun) via the private network.
Public domain works fine but not the private domain.
I'm surely doing something wrong but I cannot pinpoint it.
Here is my Bun (let's call it theBun):
Bun.serve({
hostname: "::",
port: import.meta.env.PORT ?? 3000,
async fetch(request) {
// Doing stuff
},
});
I tried setting the URL like that:
- http://${{theBun.RAILWAY_PRIVATE_DOMAIN}}
- http://${{theBun.RAILWAY_PRIVATE_DOMAIN}}:${{theBun.PORT}}
EDIT:
More context and testing:
I'm able to connect to my webApp to another service (named strapi) via private domain:port.
But I can't do the same from another Bun service (same URL) and I got a connection refused error.
So I guess it's the Bun services which are not properly configured.
What I'm missing?
Thx for your answers.
6 Replies
Status changed to Awaiting User Response railway[bot] • 3 months ago
angelo
Does the server successfully listen when starting?
3 months ago
Hi anglelo,
Yes it does, no error and everything works fine while using the public domain.
Status changed to Awaiting Railway Response railway[bot] • 3 months ago
plumillon
Hi anglelo,Yes it does, no error and everything works fine while using the public domain.
3 months ago
Oki, after investigating I realised something silly: I'm building my Flutter app for web so everything is executed over http via js.
Which mean my requests are going over public network and don't seem to be able to see the private network.
Can you confirm it's normal behaviour?
Now I'm investigating the private network communication between the other Buns. Can we let this thread open?
If you have insights it would help.
EDIT: I just tested and my Bun is unable to access my Strapi instance via private network (http://${{strapi.RAILWAY_PRIVATE_DOMAIN}}:${{strapi.PORT}}).
I got this error:
error: Unable to connect. Is the computer able to access the url?
path: "http://outerly-staging-strapi.railway.internal:1337/api/..........";,
errno: 0,
code: "ConnectionRefused",
On this code:
const response = await fetch(
new Request(process.env.API_URL!, {
method: "PUT",
body: JSON.stringify({ userId, type, status: status }),
headers: {
"Authorization": `Bearer ${process.env.API_SECRET!}`,
"Content-Type": "application/json"
}
})
);
3 months ago
I'm back, I found the issue: Strapi cannot doesn't seem to be able to listen to ipv6 (yet).
Would you think it would be possible to Dockerize my Strapi and route the ipv6 request to the container ipv4?
3 months ago
That sounds doable ! I know some people have successfully added a proxy to non ipv4 services to add ipv6 compatibility - however I'm not familiar with the subject myself
Status changed to Awaiting User Response railway[bot] • 3 months ago
3 months ago
I looked into it, it's definitively doable and I'll do it later.
Thanks for the support and being the perfect duck, you can resolve the thread if you like :)
Status changed to Awaiting Railway Response railway[bot] • 3 months ago
Status changed to Solved itsrems • 3 months ago