I'm attempting to use the Twilio TaskRouter.js sample app but am encountering a persistent WebSocket connection error to 'wss://[invalid URL removed]...'. The worker immediately disconnects afterward.
Steps to Reproduce
Clone the repository git clone https://github.com/twilio/twilio-taskrouter.js
Choose correct directory and install dependencies cd twilio-taskrouter.js/sample-app && yarn
Run the app yarn dev
Supply correct values for environment variables.
Start the sample application.
Observed Behavior
Console errors:
[2024-03-08T18:35:40.643Z] Disconnecting websocket
worker.client.tsx:80 [2024-03-08T18:35:40.644Z] Received Event: 'disconnected' from Signaling layer for Worker %s. %s {message: 'SDK Disconnect'}
worker.client.tsx:80 [2024-03-08T18:35:40.644Z] Unsubscribing from TaskRouter events ...
log-context.tsx:26 disconnected--Worker is disconnected. reason: {"message":"SDK Disconnect"}
log-context.tsx:26 ======================================================
log-context.tsx:26 Token generated
log-context.tsx:26 <valid_jwt_token>
log-context.tsx:26 Initializing Worker with the new token
worker.client.tsx:69 [2024-03-08T18:35:40.647Z] Subscribing to Signaling events ....
worker.client.tsx:69 WebSocket connection to 'wss://event-bridge.stage-us1.twilio.com/v1/wschannels?token=<token>&closeExistingSessions=true&clientVersion=2.0.3' failed:
worker.client.tsx:69 [2024-03-08T18:36:10.676Z] WebSocket error occurred:
Event {isTrusted: true, type: 'error', target: WebSocket, currentTarget: WebSocket, eventPhase: 2, …}
index.window.js:4 [2024-03-08T18:36:10.678Z] Received Event: 'error' from Signaling layer for Worker %s.
log-context.tsx:26 error--Worker errored out. error: {}
worker.client.tsx:127 [2024-03-08T18:36:10.679Z] Disconnecting websocket
worker.client.tsx:127 [2024-03-08T18:36:10.679Z] Received Event: 'disconnected' from Signaling layer for Worker %s. %s
{message: 'SDK Disconnect'}
worker.client.tsx:127 [2024-03-08T18:36:10.679Z] Unsubscribing from TaskRouter events ...
log-context.tsx:26 disconnected--Worker is disconnected. reason: {"message":"SDK Disconnect"}
Expected Behaviour
The sample app should establish a WebSocket connection to Twilio TaskRouter and maintain worker availability.
Attempted Troubleshooting
Verified the accuracy of provided credentials.
Checked firewall and proxy settings (cannot identify restrictions)
Used Twilio TaskRouter JS SDK v1 successfully, suggesting the issue might be specific to the sample app or SDK v2
Environment variables were not correct
Description
I'm attempting to use the Twilio TaskRouter.js sample app but am encountering a persistent WebSocket connection error to 'wss://[invalid URL removed]...'. The worker immediately disconnects afterward.
Steps to Reproduce
git clone https://github.com/twilio/twilio-taskrouter.js
cd twilio-taskrouter.js/sample-app && yarn
yarn dev
Observed Behavior
Expected Behaviour
The sample app should establish a WebSocket connection to Twilio TaskRouter and maintain worker availability.
Attempted Troubleshooting
Environment
Operating System: macOS Sonoma 14.3.1 Browser: Chrome Version 122.0.6261.112 Node.js Version: v18.19.1 Twilio TaskRouter JS SDK Version: v2.0.3
Request
I'd greatly appreciate any help on debugging this issue.
Could it be related to the sample app, or are there other troubleshooting steps I should consider?