0

I'm setting up a realtime chat with Twilio programmable chat via the twilio-chat npm package and while my acess token is being generated successfully (I can see it has the correct content when I check it on https://jwt.io), calling the Twilio API to create a client using that token fails with the error TypeError: _parser_1$Parser$pars is undefined.

Bizarrely, this was working totally fine yesterday. I've checked Twilio's status page but everything is green. I've used the debugger in Firefox to see if I can spot where the error is occurring and it seems that a message is being received with a type of "". The undefined value is the result of parsing that message.

import twilio from 'twilio-chat'

const chatToken = await myChatApi.getChatToken()

const client = await twilio.create(chatToken)
console.log('This log never gets called')

client never gets a value and the console.log() never gets run.

Shortly after the TypeError: _parser_1$Parser$pars is undefined error, I also get TypeError: this.listeners.onmessage is not a functionfeatures:75:18.

UPDATE (after speaking to Twilio support): Running my app in Chrome instead of Firefox, I get a different error: Error: Can't connect to twilsock. Each browser gets its error message consistently if I use different internet connections. Twilio support have confirmed that my access tokens are correct and my Api keys and account SID match.

I've also tried running the quick start app from https://www.twilio.com/docs/chat/javascript/quickstart. It works fine in Chrome, but in Firefox I get what looks like the same error I get from my own app in Firefox (though it's hard to say as the code is minified): TypeError: t is undefined.

Gary Holland
  • 1
  • 1
  • 1

0 Answers0