Skip to content

Conversation

@anagstef
Copy link
Member

@anagstef anagstef commented Sep 19, 2024

Description

This PR extracts more error reasons to be set on __clerk_refresh query param, instead of falling back to unexpected-refresh-error.

New error codes are:

  • missing-api-client
  • missing-session-token
  • missing-refresh-token
  • session-token-decode-failed
  • fetch-network-error

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot
Copy link

changeset-bot bot commented Sep 19, 2024

🦋 Changeset detected

Latest commit: e9007ed

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@clerk/backend Patch
@clerk/astro Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
@clerk/tanstack-start Patch
@clerk/testing Patch

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

@anagstef anagstef self-assigned this Sep 19, 2024
@anagstef anagstef marked this pull request as ready for review September 19, 2024 12:26
@anagstef
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @anagstef - the snapshot version command generated the following package versions:

Package Version
@clerk/astro 1.3.7-snapshot.v150a390
@clerk/backend 1.13.3-snapshot.v150a390
@clerk/chrome-extension 1.3.9-snapshot.v150a390
@clerk/clerk-js 5.22.4-snapshot.v150a390
@clerk/elements 0.15.5-snapshot.v150a390
@clerk/clerk-expo 2.2.15-snapshot.v150a390
@clerk/express 0.1.4-snapshot.v150a390
@clerk/fastify 1.0.46-snapshot.v150a390
@clerk/localizations 3.0.5-snapshot.v150a390
@clerk/nextjs 5.6.1-snapshot.v150a390
@clerk/clerk-react 5.9.2-snapshot.v150a390
@clerk/remix 4.2.30-snapshot.v150a390
@clerk/clerk-sdk-node 5.0.43-snapshot.v150a390
@clerk/shared 2.8.2-snapshot.v150a390
@clerk/tanstack-start 0.4.6-snapshot.v150a390
@clerk/testing 1.3.4-snapshot.v150a390
@clerk/themes 2.1.31-snapshot.v150a390
@clerk/types 4.21.1-snapshot.v150a390

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/astro

npm i @clerk/astro@1.3.7-snapshot.v150a390 --save-exact

@clerk/backend

npm i @clerk/backend@1.13.3-snapshot.v150a390 --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@1.3.9-snapshot.v150a390 --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.22.4-snapshot.v150a390 --save-exact

@clerk/elements

npm i @clerk/elements@0.15.5-snapshot.v150a390 --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@2.2.15-snapshot.v150a390 --save-exact

@clerk/express

npm i @clerk/express@0.1.4-snapshot.v150a390 --save-exact

@clerk/fastify

npm i @clerk/fastify@1.0.46-snapshot.v150a390 --save-exact

@clerk/localizations

npm i @clerk/localizations@3.0.5-snapshot.v150a390 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@5.6.1-snapshot.v150a390 --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.9.2-snapshot.v150a390 --save-exact

@clerk/remix

npm i @clerk/remix@4.2.30-snapshot.v150a390 --save-exact

@clerk/clerk-sdk-node

npm i @clerk/clerk-sdk-node@5.0.43-snapshot.v150a390 --save-exact

@clerk/shared

npm i @clerk/shared@2.8.2-snapshot.v150a390 --save-exact

@clerk/tanstack-start

npm i @clerk/tanstack-start@0.4.6-snapshot.v150a390 --save-exact

@clerk/testing

npm i @clerk/testing@1.3.4-snapshot.v150a390 --save-exact

@clerk/themes

npm i @clerk/themes@2.1.31-snapshot.v150a390 --save-exact

@clerk/types

npm i @clerk/types@4.21.1-snapshot.v150a390 --save-exact

// To perform a token refresh, apiClient must be defined.
assertApiClient(options.apiClient);
} catch (err: any) {
throw { errors: [{ code: RefreshTokenErrorReason.MissingApiClient, message: err?.message || '' }] };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the mix between single error and errors array? I've only seen single errors, not multiple, in your code below 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LekoArts an errors array is returned on API errors.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just refactored this, to be clearer.

@anagstef
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @anagstef - the snapshot version command generated the following package versions:

Package Version
@clerk/astro 1.3.7-snapshot.v51c436a
@clerk/backend 1.13.3-snapshot.v51c436a
@clerk/chrome-extension 1.3.9-snapshot.v51c436a
@clerk/clerk-js 5.22.4-snapshot.v51c436a
@clerk/elements 0.15.5-snapshot.v51c436a
@clerk/clerk-expo 2.2.15-snapshot.v51c436a
@clerk/express 0.1.4-snapshot.v51c436a
@clerk/fastify 1.0.46-snapshot.v51c436a
@clerk/localizations 3.0.5-snapshot.v51c436a
@clerk/nextjs 5.6.1-snapshot.v51c436a
@clerk/clerk-react 5.9.2-snapshot.v51c436a
@clerk/remix 4.2.30-snapshot.v51c436a
@clerk/clerk-sdk-node 5.0.43-snapshot.v51c436a
@clerk/shared 2.8.2-snapshot.v51c436a
@clerk/tanstack-start 0.4.6-snapshot.v51c436a
@clerk/testing 1.3.4-snapshot.v51c436a
@clerk/themes 2.1.31-snapshot.v51c436a
@clerk/types 4.21.1-snapshot.v51c436a

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/astro

npm i @clerk/astro@1.3.7-snapshot.v51c436a --save-exact

@clerk/backend

npm i @clerk/backend@1.13.3-snapshot.v51c436a --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@1.3.9-snapshot.v51c436a --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.22.4-snapshot.v51c436a --save-exact

@clerk/elements

npm i @clerk/elements@0.15.5-snapshot.v51c436a --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@2.2.15-snapshot.v51c436a --save-exact

@clerk/express

npm i @clerk/express@0.1.4-snapshot.v51c436a --save-exact

@clerk/fastify

npm i @clerk/fastify@1.0.46-snapshot.v51c436a --save-exact

@clerk/localizations

npm i @clerk/localizations@3.0.5-snapshot.v51c436a --save-exact

@clerk/nextjs

npm i @clerk/nextjs@5.6.1-snapshot.v51c436a --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.9.2-snapshot.v51c436a --save-exact

@clerk/remix

npm i @clerk/remix@4.2.30-snapshot.v51c436a --save-exact

@clerk/clerk-sdk-node

npm i @clerk/clerk-sdk-node@5.0.43-snapshot.v51c436a --save-exact

@clerk/shared

npm i @clerk/shared@2.8.2-snapshot.v51c436a --save-exact

@clerk/tanstack-start

npm i @clerk/tanstack-start@0.4.6-snapshot.v51c436a --save-exact

@clerk/testing

npm i @clerk/testing@1.3.4-snapshot.v51c436a --save-exact

@clerk/themes

npm i @clerk/themes@2.1.31-snapshot.v51c436a --save-exact

@clerk/types

npm i @clerk/types@4.21.1-snapshot.v51c436a --save-exact

@anagstef
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @anagstef - the snapshot version command generated the following package versions:

Package Version
@clerk/astro 1.3.7-snapshot.ve9007ed
@clerk/backend 1.13.3-snapshot.ve9007ed
@clerk/chrome-extension 1.3.9-snapshot.ve9007ed
@clerk/clerk-js 5.22.4-snapshot.ve9007ed
@clerk/elements 0.15.5-snapshot.ve9007ed
@clerk/clerk-expo 2.2.15-snapshot.ve9007ed
@clerk/express 0.1.4-snapshot.ve9007ed
@clerk/fastify 1.0.46-snapshot.ve9007ed
@clerk/localizations 3.0.5-snapshot.ve9007ed
@clerk/nextjs 5.6.1-snapshot.ve9007ed
@clerk/clerk-react 5.9.2-snapshot.ve9007ed
@clerk/remix 4.2.30-snapshot.ve9007ed
@clerk/clerk-sdk-node 5.0.43-snapshot.ve9007ed
@clerk/shared 2.8.2-snapshot.ve9007ed
@clerk/tanstack-start 0.4.6-snapshot.ve9007ed
@clerk/testing 1.3.4-snapshot.ve9007ed
@clerk/themes 2.1.31-snapshot.ve9007ed
@clerk/types 4.21.1-snapshot.ve9007ed

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/astro

npm i @clerk/astro@1.3.7-snapshot.ve9007ed --save-exact

@clerk/backend

npm i @clerk/backend@1.13.3-snapshot.ve9007ed --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@1.3.9-snapshot.ve9007ed --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.22.4-snapshot.ve9007ed --save-exact

@clerk/elements

npm i @clerk/elements@0.15.5-snapshot.ve9007ed --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@2.2.15-snapshot.ve9007ed --save-exact

@clerk/express

npm i @clerk/express@0.1.4-snapshot.ve9007ed --save-exact

@clerk/fastify

npm i @clerk/fastify@1.0.46-snapshot.ve9007ed --save-exact

@clerk/localizations

npm i @clerk/localizations@3.0.5-snapshot.ve9007ed --save-exact

@clerk/nextjs

npm i @clerk/nextjs@5.6.1-snapshot.ve9007ed --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.9.2-snapshot.ve9007ed --save-exact

@clerk/remix

npm i @clerk/remix@4.2.30-snapshot.ve9007ed --save-exact

@clerk/clerk-sdk-node

npm i @clerk/clerk-sdk-node@5.0.43-snapshot.ve9007ed --save-exact

@clerk/shared

npm i @clerk/shared@2.8.2-snapshot.ve9007ed --save-exact

@clerk/tanstack-start

npm i @clerk/tanstack-start@0.4.6-snapshot.ve9007ed --save-exact

@clerk/testing

npm i @clerk/testing@1.3.4-snapshot.ve9007ed --save-exact

@clerk/themes

npm i @clerk/themes@2.1.31-snapshot.ve9007ed --save-exact

@clerk/types

npm i @clerk/types@4.21.1-snapshot.ve9007ed --save-exact

@nikosdouvlis nikosdouvlis merged commit e0ca9dc into main Sep 23, 2024
@nikosdouvlis nikosdouvlis deleted the stefanos/add-more-error-reasons-for-refresh-token branch September 23, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants