Thursday, 17 September 2020

Twilio JS - Client.getChannelBySid Throws Error: Not Found

I created a chat client using Twilio, using their JavaScript client on the front end. I'm making the following call to get a channel by SID

let channel_promise = client.getChannelBySid(sid);

This worked fine for months, but now out of the blue I'm getting the following error:

twilio-chat.js:28610 Uncaught (in promise) Error: Not Found
    at TwilsockUpstreamError.ExtendableBuiltin (twilio-chat.js:28610)
    at TwilsockUpstreamError.TwilsockError (twilio-chat.js:28640)
    at new TwilsockUpstreamError (twilio-chat.js:28719)
    at Upstream._callee$ (twilio-chat.js:30068)
    at tryCatch (twilio-chat.js:14232)
    at Generator.invoke [as _invoke] (twilio-chat.js:14466)
    at Generator.prototype.<computed> [as next] (twilio-chat.js:14284)
    at step (twilio-chat.js:8227)
    at twilio-chat.js:8238
ExtendableBuiltin   @   twilio-chat.js:28610
TwilsockError   @   twilio-chat.js:28640
TwilsockUpstreamError   @   twilio-chat.js:28719
_callee$    @   twilio-chat.js:30068
tryCatch    @   twilio-chat.js:14232
invoke  @   twilio-chat.js:14466
prototype.<computed>    @   twilio-chat.js:14284
step    @   twilio-chat.js:8227
(anonymous) @   twilio-chat.js:8238
Promise.then (async)        
success @   conversations.js:653
j   @   jquery-1.11.0.min.js:2
fireWith    @   jquery-1.11.0.min.js:2
x   @   jquery-1.11.0.min.js:4
b   @   jquery-1.11.0.min.js:4
XMLHttpRequest.send (async)     
(anonymous) @   VM11:1
send    @   jquery-1.11.0.min.js:4
ajax    @   jquery-1.11.0.min.js:4
join_conversation   @   conversations.js:617
dispatch    @   jquery-1.11.0.min.js:3
r.handle    @   jquery-1.11.0.min.js:3

I'm fetching the client library from their CDN and specifying the version, so I'm fairly confident this isn't breaking due to a change in the client code.

<script src="https://media.twiliocdn.com/sdk/js/chat/v3.3/twilio-chat.js"></script>

I confirmed the channel SID I'm using is correct by logging it to console, and then using the twilio-cli to look up existing channels. The output from the cli matches the console output, so I know that I'm using the correct SID.

Does anyone have any idea why this call is failing? How can I get the channel without an error?



from Twilio JS - Client.getChannelBySid Throws Error: Not Found

No comments:

Post a Comment