nextjs can't connect to railway local network
userdeh
HOBBYOP

6 days ago

i connect to the nextjs server with ```railway ssh``` command and then run wget command to http://core.railway.internal:3001 and get connection refused error.

Solved$10 Bounty

6 Replies

Railway
BOT

6 days ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


userdeh
HOBBYOP

6 days ago

the application is honojs and run on 0.0.0.0:3001


bytekeim
PRO

6 days ago

can you railway ssh into the core service (the hono one) while it’s running, and paste the output of this command:

ss -tuln | grep 3001

(or netstat -tuln | grep 3001 if ss is not available)

and also tett m does curl http://127.0.0.1:3001 (or wget -O- http://localhost:3001) work inside the same core container?


bytekeim

can you railway ssh into the core service (the hono one) while it’s running, and paste the output of this command:ss -tuln | grep 3001(or netstat -tuln | grep 3001 if ss is not available)and also tett m does curl http://127.0.0.1:3001 (or wget -O- http://localhost:3001) work inside the same core container?

userdeh
HOBBYOP

6 days ago

there is no ss, netstat, curl or wget installed on railway service. but i found alternative:

cat /proc/net/tcp | grep "0BB9"

0: 00000000:0BB9 00000000:0000 0A 00000000:00000000 00:00000000 00000000     0        0 2161798467 1 000000001b1769e7 100 0 0 10 0 

In simple English

This line means:

“There is a TCP socket listening on 0.0.0.0:3001, in LISTEN state, owned by UID 0.”

Instead of curl or wget, i do the following instruction:

node -e "

  require('http').get('http://localhost:3001/health', r => {

    r.on('data', d => process.stdout.write(d));

  });

"

{"status":"ok","service":"auth"}


bytekeim
PRO

6 days ago

yes i see ur /proc/net/tcp output 100 % confirms the problem: the Hono server is listening only on IPv4 (00000000:0BB9 = 0.0.0.0:3001).

copy and paste this into your Hono "core" service)

If you are using @hono/node-server (most common for Hono on Node):

typeScript

import { serve } from '@hono/node-server'
import { app } from './app'   // your hono app

serve({
  fetch: app.fetch,
  port: Number(process.env.PORT) || 3001,
  hostname: '::',   // ← this forces IPv6 + IPv4 dual-stack
})

If you are using hono/bun (Bun.serve):

typeScript

Bun.serve({
  fetch: app.fetch,
  port: Number(process.env.PORT) || 3001,
  hostname: '::',   // ← critical line
})

push and redeploy and lmk the result !


bytekeim

yes i see ur /proc/net/tcp output 100 % confirms the problem: the Hono server is listening only on IPv4 (00000000:0BB9 = 0.0.0.0:3001).copy and paste this into your Hono "core" service)If you are using @hono/node-server (most common for Hono on Node):typeScriptimport { serve } from '@hono/node-server' import { app } from './app' // your hono app serve({ fetch: app.fetch, port: Number(process.env.PORT) || 3001, hostname: '::', // ← this forces IPv6 + IPv4 dual-stack })If you are using hono/bun (Bun.serve):typeScriptBun.serve({ fetch: app.fetch, port: Number(process.env.PORT) || 3001, hostname: '::', // ← critical line })push and redeploy and lmk the result !

userdeh
HOBBYOP

6 days ago

its work. thanks


Status changed to Solved uxuz 6 days ago


Loading...