2 months ago
Hello Railway Support,
I am trying to run the OpenClaw gateway on Railway using the official template, but I cannot establish a WebSocket connection from the OpenClaw dashboard. The deployment starts correctly, but the connection is always closed with “pairing required”.
Key details:
- Platform: Railway
- Service: OpenClaw gateway (deployed from the Railway template)
- Dashboard origin:
https://openclaw-production-14c3.up.railway.app - Log excerpt from the Railway deploy:
What I have already done:
- Set
OPENCLAW_GATEWAY_TOKENin Railway and used the same token in the OpenClaw dashboard Gateway Token field. - Verified the WebSocket URL is the Railway service URL with
wss://and no typos. - Opened a Shell in the Railway service container and ran:
openclaw devices listopenclaw devices approve --latestHowever, I still get the same “code=1008 reason=pairing required” WebSocket close error in the Railway logs.
My questions:
- Is there anything in Railway’s networking/proxy/WebSocket configuration that could prevent OpenClaw’s pairing from completing (for example, headers, sticky sessions, or timeouts)?
- Do I need any special configuration on Railway (ports, health checks, variables) for persistent WebSocket connections with OpenClaw?
- Could you check my current deployment and tell me if something in the Railway setup is interfering with the pairing process?
Any guidance or example configuration for running OpenClaw on Railway with successful WebSocket pairing would be very helpful.
Thank you in advance for your help!
Attachments
4 Replies
Status changed to Awaiting Railway Response Railway • 2 months ago
2 months ago
The issue is not related to Railway networking or WebSocket support. Railway supports persistent WebSocket connections by default, so no special proxy, port, or sticky session configuration is required.
The screenshot shows the gateway returning “pairing required”, which means the dashboard client has not yet been approved by the OpenClaw gateway.
OpenClaw requires every client (dashboard, CLI, or node) to be explicitly paired with the gateway before it can maintain a WebSocket connection. If the device has not been approved, the gateway will immediately close the connection with:
code=1008 reason=pairing required
To resolve this, approve the pending device request from inside the Railway service container.
Open the Railway service shell and run: openclaw devices list
You should see a pending device request. Then approve it with: openclaw devices approve --latest
After approving the device, refresh the OpenClaw dashboard and reconnect. The gateway status should change from Offline to Online, and the WebSocket connection will remain active.
Also verify that the same OPENCLAW_GATEWAY_TOKEN value is used both in the Railway environment variables and in the dashboard’s Gateway Token field.
In short: the error is coming from OpenClaw’s security model (device pairing), not from Railway’s networking configuration.
The issue is not related to Railway networking or WebSocket support. Railway supports persistent WebSocket connections by default, so no special proxy, port, or sticky session configuration is required. The screenshot shows the gateway returning **“pairing required”**, which means the dashboard client has not yet been approved by the OpenClaw gateway. OpenClaw requires every client (dashboard, CLI, or node) to be explicitly paired with the gateway before it can maintain a WebSocket connection. If the device has not been approved, the gateway will immediately close the connection with: `code=1008 reason=pairing required` To resolve this, approve the pending device request from inside the Railway service container. Open the Railway service shell and run: openclaw devices list You should see a pending device request. Then approve it with: openclaw devices approve --latest After approving the device, refresh the OpenClaw dashboard and reconnect. The gateway status should change from **Offline** to **Online**, and the WebSocket connection will remain active. Also verify that the same `OPENCLAW_GATEWAY_TOKEN` value is used both in the Railway environment variables and in the dashboard’s Gateway Token field. In short: the error is coming from OpenClaw’s security model (device pairing), not from Railway’s networking configuration.
2 months ago
Thanks for the reply, but could you please tell me where this setting is? I can't find the Railway service shell. Run the command: openclaw devices list. You should see a pending device request.
2 months ago
Hey, in the /setup page, you would see some option like "Manage Devices". You have to approve your browser request to access the openclaw dashboard UI from there.
2 months ago
I am using this template -
https://railway.com/deploy/openclaw-prev-clawdbot-moltbot-self-host
And for me, you can see after "Run setup", there is an option on top right to "Manage Devices".
Every new browser access for OpenClaw UI needs to be approved from there
Attachments
