chore(clerk-js): Improve Token.create to handle error due to network failure - #3068
Conversation
🦋 Changeset detectedLatest commit: 2580596 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
8b7a627 to
eb4f14c
Compare
|
!snapshot |
eb4f14c to
2063010
Compare
|
Hey @dimkl - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/backend@0.38.4-snapshot.veb4f14c --save-exact
npm i @clerk/chrome-extension@0.6.17-snapshot.veb4f14c --save-exact
npm i @clerk/clerk-js@4.70.7-snapshot.veb4f14c --save-exact
npm i @clerk/clerk-expo@0.20.12-snapshot.veb4f14c --save-exact
npm i @clerk/fastify@0.6.37-snapshot.veb4f14c --save-exact
npm i gatsby-plugin-clerk@4.4.39-snapshot.veb4f14c --save-exact
npm i @clerk/localizations@1.26.17-snapshot.veb4f14c --save-exact
npm i @clerk/nextjs@4.29.10-snapshot.veb4f14c --save-exact
npm i @clerk/clerk-react@4.30.8-snapshot.veb4f14c --save-exact
npm i @clerk/remix@3.2.1-snapshot.veb4f14c --save-exact
npm i @clerk/clerk-sdk-node@4.13.12-snapshot.veb4f14c --save-exact
npm i @clerk/themes@1.7.11-snapshot.veb4f14c --save-exact
npm i @clerk/types@3.62.2-snapshot.veb4f14c --save-exact |
2063010 to
deb94e2
Compare
|
!snapshot |
|
Hey @dimkl - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/backend@0.38.4-snapshot.vdeb94e2 --save-exact
npm i @clerk/chrome-extension@0.6.17-snapshot.vdeb94e2 --save-exact
npm i @clerk/clerk-js@4.70.7-snapshot.vdeb94e2 --save-exact
npm i @clerk/clerk-expo@0.20.12-snapshot.vdeb94e2 --save-exact
npm i @clerk/fastify@0.6.37-snapshot.vdeb94e2 --save-exact
npm i gatsby-plugin-clerk@4.4.39-snapshot.vdeb94e2 --save-exact
npm i @clerk/localizations@1.26.17-snapshot.vdeb94e2 --save-exact
npm i @clerk/nextjs@4.29.10-snapshot.vdeb94e2 --save-exact
npm i @clerk/clerk-react@4.30.8-snapshot.vdeb94e2 --save-exact
npm i @clerk/remix@3.2.1-snapshot.vdeb94e2 --save-exact
npm i @clerk/clerk-sdk-node@4.13.12-snapshot.vdeb94e2 --save-exact
npm i @clerk/themes@1.7.11-snapshot.vdeb94e2 --save-exact
npm i @clerk/types@3.62.2-snapshot.vdeb94e2 --save-exact |
…failure Error resolved by returning an empty string or null instead of trying to decode the `jwt` property from the response data. After this fix an `token.getRawString()` will return an empty string and `session.getToken()` will return `null` on Network failure and when request fails and browser is offline. Current error message example: ``` Error: ClerkJS: Token refresh failed (error='Cannot read properties of null (reading 'jwt')') ```
deb94e2 to
2580596
Compare
Description
Error resolved by returning an empty string or null instead of trying to decode the
jwtproperty from the response data. After this fix antoken.getRawString()will return an empty string andsession.getToken()will returnnullon Network failure and when request fails and browser is offline.Current error message example:
Backport: #3035
Checklist
npm testruns as expected.npm run buildruns as expected.Type of change