Nodejs Agent running in livekit cloud. Agent fails...
# ask-ai
c
Nodejs Agent running in livekit cloud. Agent fails to join room and I see this error in server side logs.
Copy code
{"type":"ConnectError","message":"engine: signal failure: failed to retrieve region info: error sending request for url (https://<my-project>.livekit.cloud/settings/regions)
t
Thanks for reaching out, Shane. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m looking at the ConnectError about failing to retrieve region info when your Node.js agent (running in LiveKit Cloud) tries to join a room. Let’s narrow this down so I can help you fix it. Quick checks you can do now • Confirm the project host is correct: the agent should request https://<your-project>.livekit.cloud/settings/regions — ensure your
<my-project>
subdomain is spelled exactly as in your LiveKit project. • Verify SDK initialization: ensure your agent connects with the correct server URL (example for signaling uses
wss://<your-project>.livekit.cloud
) and a valid token. • Check for region pinning: if you’ve enabled region pinning, confirm the pinned region is valid for your project. • Retry and inspect logs: try a reconnect and share the surrounding log lines and timestamps (especially any repeated failures or HTTP errors when fetching
/settings/regions
). • Confirm SDK version: ensure you’re running a recent LiveKit Node SDK (older versions can have region-discovery bugs). A couple targeted questions to help me diagnose 1. Can you paste the exact server URL and code snippet you use to initialize/connect the Room (redact tokens)? 2. Is region pinning enabled for this project? If so, which region is pinned? 3. Do the agent logs show an HTTP status or DNS error for the
/settings/regions
request (e.g., 4xx/5xx or “name not resolved”)? 4. Did this start suddenly or after a change (deploy, config change, SDK upgrade)? If you share the answers and the relevant log lines, I’ll suggest the next steps (configuration change, retry pattern, or a specific debugging snippet). Sources: Diagnosing Connection Errors with Connection Test Utility | Region pinning | LiveKit docs | Configuring firewalls | LiveKit docs
c
1. wss://<my-project>.livekit.cloud/rtc?access_token=<TOKEN>&auto_subscribe=1&sdk=js&version=2.16.0&protocol=16 2. We have not enabled region pinning 3. No the ConnectError shown above is the only information about the connection error. It includes this stacktrace though
at Room.connect (file:///app/node_modules/@livekit/rtc-node/dist/room.js:469:15)\n    at async JobContext.connect (file:///app/node_modules/@livekit/agents/dist/job.js:131:5)\n    at async entry (file:///app/dist/agent.js:4517:5)\n    at async file:///app/node_modules/@livekit/agents/dist/ipc/job_proc_lazy_main.js:72:5"
4. This is only happening when deploying the agent to cloud. Locally the agent connects to the room with no errors
t
Thanks — this is helpful. You're seeing the ConnectError only in the cloud deployment while the same code works locally. That strongly indicates an environment/network issue in the cloud agent. What to check next (quick, targeted steps) 1. DNS + reachability from the agent container ◦ Run:
curl -v https://<my-project>.livekit.cloud/settings/regions
from inside the deployed agent container (or use `dig`/`nslookup` if available). Paste the response or errors. 1. WebSocket handshake test ◦ From the same environment, test a simple WebSocket connect (wscat or a small Node script) to your full wss URL to see if the handshake succeeds or returns an HTTP error. 1. Egress/network policy ◦ Confirm the cloud agent environment allows outbound TLS (TCP 443) and can resolve wildcard LiveKit domains. If your deployment platform has egress filtering, allow
*.livekit.cloud
. 1. SDK and URL sanity ◦ Your
wss://<my-project>.livekit.cloud/rtc?access_token=...&...&sdk=js&version=2.16.0&protocol=16
looks correct. Ensure the agent uses the same SDK version (2.16.0) or a recent patch. 1. Minimal repro ◦ Deploy a tiny test job in the same cloud environment that only runs Room.connect then logs success/failure. This isolates agent job lifecycle concerns. Please share: • Output of the `curl`/DNS test or the WebSocket test errors. • Any platform egress/firewall settings for the cloud agent (if you can paste relevant rules). • The agent container/node SDK version if different from 2.16.0. With those logs I’ll suggest the exact next steps (DNS fix, egress rule change, or a retry/workaround). Would you like the exact curl and minimal Node test snippets to run inside the container? Sources: Connecting to LiveKit | LiveKit docs | Configuring firewalls | LiveKit docs | Job lifecycle | LiveKit docs | Agent deployment CLI reference | LiveKit docs