twilio-node
twilio-node copied to clipboard
Right-hand side of 'instanceof' is not an object for token.toJwt() (next.js)
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
Steps to Reproduce
- This is the first step
- This is the second step
- 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",
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.
Closing this issue as not an issue from twilio