twilio-node icon indicating copy to clipboard operation
twilio-node copied to clipboard

Right-hand side of 'instanceof' is not an object for token.toJwt() (next.js)

Open MarkovskiyKonstantin opened this issue 10 months ago • 1 comments

Issue Summary

When I create an access token and add it to jwt I get a error Right-hand side of 'instanceof' is not an object for next.js app image

Steps to Reproduce

  1. This is the first step
  2. This is the second step
  3. Further steps, etc.

Code Snippet

    const AccessToken = Twilio.jwt.AccessToken;

    const VoiceGrant = AccessToken.VoiceGrant;
    
    const token = new AccessToken(accountSid, apiKey, apiKeySecret, {identity});

    const voiceGrant = new VoiceGrant({
      incomingAllow: true, // Optional: add to allow incoming calls
      outgoingApplicationSid: accountSid,
    });

   token.addGrant(voiceGrant);

    console.log('### token', token.toJwt());

    

Technical details:

"twilio": "4.23.0", node version: v20.9.0 "next": "13.3.2",

MarkovskiyKonstantin avatar Apr 04 '24 14:04 MarkovskiyKonstantin

I think this is an open issue with jsonwebtoken v9, see here. A quick fix can be that we can revert the version from 9.0.0 to 8.5.1 but the permanent fix will be done by this library only. So it is more of an issue for that repository.

tiwarishubham635 avatar May 06 '24 08:05 tiwarishubham635

Closing this issue as not an issue from twilio

tiwarishubham635 avatar May 21 '24 17:05 tiwarishubham635