0

Given this, im getting this output...

import { Client } from '@twilio/conversations';

... crap....

this.client = new Client(this.token);
      this.client.on('stateChanged', state => {
        if (state === 'initialized') {
          this.ready = true;
          this.emitter.emit('ready');

... more stuff....
browser.js?edd1:6945 Uncaught (in promise) TypeError: twilsock.InitRegistration is not a constructor
at new Client (browser.js?edd1:6945:1)
at _class._createSuperInternal (browser.js?7253:148:1)
at new _class (browser.js?7253:239:1)
at eval (TwilioProvider.js?d6b9:149:1)
at new Promise (<anonymous>)
at TwilioProvider.start (TwilioProvider.js?d6b9:135:1)
at eval (start.js?e8a3:39:1)
at Object.eval [as dispatch] (index.js?4dd3:11:1)
at dispatch (<anonymous>:10607:80)
at eval (redux.js?a67e:483:1)

I've stopped the debugger at that line and this is the value of twilsock on that line... any suggestions?

debug value

Clark T.
  • 1,470
  • 2
  • 11
  • 25
  • What environment are you running this application in? And what version of `@twilio/conversations` are you using? – philnash Jan 27 '22 at 03:47
  • local dev, and 2.0.1 @philnash – Clark T. Jan 27 '22 at 18:57
  • Local dev in what? Is this just in a browser? I can see a reference to browser.js, where does that come from? Are you building this project with a bundler of some sorts? If I was to try to reproduce how you are building with this, how would I go about it? – philnash Jan 27 '22 at 22:31
  • 1
    What Twilsock version do you have in your dependency lock file? Is this an older project that was upgraded from conversations 1.x to 2.x? Try removing the lock file and re-fetching the deps in this case. – berkus Jan 31 '22 at 13:18

1 Answers1

1

Issue was due to yarn link resolving twilsock to an older version. i hard linked it by altering the version to link:{filepath} and all is well.

Clark T.
  • 1,470
  • 2
  • 11
  • 25