Skip to content

Conversation

@anagstef
Copy link
Member

@anagstef anagstef commented Nov 8, 2024

Description

This is a bug fix that relates to #3563, where we used to silence network errors on Expo.

In this PR, we bubble up the fetch error when the experimental.rethrowOfflineNetworkErrors option is true on the ClerkProvider component.

Example usage on ClerkProvider:

<ClerkProvider
   experimental={{
      rethrowOfflineNetworkErrors: true
   }}
/>

Example of handling the error on Expo:

  import { isClerkRuntimeError } from "@clerk/clerk-js"

  const handleSignIn = async () => {
    try {
      const { createdSessionId, supportedFirstFactors } = await signIn.create({
        identifier: email
      });
    } catch (err) {
      if (isClerkRuntimeError(err) && err.code === 'network_error') {
         handleNetworkError();
      }
    }
  }

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 Nov 8, 2024

🦋 Changeset detected

Latest commit: a77fcda

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

This PR includes changesets to release 21 packages
Name Type
@clerk/clerk-js Minor
@clerk/types Minor
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/elements Patch
@clerk/expo-passkeys Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/localizations Patch
@clerk/nextjs Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
@clerk/shared Patch
@clerk/tanstack-start Patch
@clerk/testing Patch
@clerk/themes Patch
@clerk/ui Patch
@clerk/vue 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
Copy link
Member Author

anagstef commented Nov 8, 2024

!snapshot

@anagstef anagstef changed the title fix(expo): Stop silencing network errors when on Expo fix(clerk-expo): Stop silencing network errors when on Expo Nov 8, 2024
@clerk-cookie
Copy link
Collaborator

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

Package Version
@clerk/astro 1.4.8-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/backend 1.16.0-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/chrome-extension 1.3.31-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/clerk-js 5.32.0-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/elements 0.18.6-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/clerk-expo 2.3.0-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/expo-passkeys 0.0.2-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/express 1.3.10-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/fastify 2.0.12-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/localizations 3.5.1-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/nextjs 6.3.0-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/clerk-react 5.15.2-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/remix 4.2.48-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/clerk-sdk-node 5.0.61-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/shared 2.12.0-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/tanstack-start 0.4.24-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/testing 1.3.22-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/themes 2.1.42-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/types 4.31.0-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d
@clerk/ui 0.1.17-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d

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

npm i @clerk/astro@1.4.8-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/backend

npm i @clerk/backend@1.16.0-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@1.3.31-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.32.0-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/elements

npm i @clerk/elements@0.18.6-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@2.3.0-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/expo-passkeys

npm i @clerk/expo-passkeys@0.0.2-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/express

npm i @clerk/express@1.3.10-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/fastify

npm i @clerk/fastify@2.0.12-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/localizations

npm i @clerk/localizations@3.5.1-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/nextjs

npm i @clerk/nextjs@6.3.0-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.15.2-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/remix

npm i @clerk/remix@4.2.48-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/clerk-sdk-node

npm i @clerk/clerk-sdk-node@5.0.61-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/shared

npm i @clerk/shared@2.12.0-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/tanstack-start

npm i @clerk/tanstack-start@0.4.24-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/testing

npm i @clerk/testing@1.3.22-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/themes

npm i @clerk/themes@2.1.42-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/types

npm i @clerk/types@4.31.0-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@clerk/ui

npm i @clerk/ui@0.1.17-snapshot.v6db56a78ff8bd026e58d6be41383e109862d0e9d --save-exact

@anagstef anagstef self-assigned this Nov 11, 2024
@anagstef anagstef marked this pull request as ready for review November 11, 2024 16:21
@anagstef anagstef marked this pull request as draft November 11, 2024 17:04
@clerk-cookie clerk-cookie removed the expo label Nov 12, 2024
@anagstef anagstef marked this pull request as ready for review November 12, 2024 12:05
@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.4.10-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/backend 1.16.2-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/chrome-extension 1.3.33-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/clerk-js 5.33.1-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/elements 0.19.2-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/clerk-expo 2.3.2-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/expo-passkeys 0.0.4-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/express 1.3.12-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/fastify 2.0.14-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/localizations 3.6.2-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/nextjs 6.3.2-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/clerk-react 5.15.4-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/remix 4.2.50-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/clerk-sdk-node 5.0.63-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/shared 2.12.2-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/tanstack-start 0.4.26-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/testing 1.3.24-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/themes 2.1.44-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/types 4.32.1-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/ui 0.1.19-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9
@clerk/vue 0.0.3-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9

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

npm i @clerk/astro@1.4.10-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/backend

npm i @clerk/backend@1.16.2-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@1.3.33-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.33.1-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/elements

npm i @clerk/elements@0.19.2-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@2.3.2-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/expo-passkeys

npm i @clerk/expo-passkeys@0.0.4-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/express

npm i @clerk/express@1.3.12-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/fastify

npm i @clerk/fastify@2.0.14-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/localizations

npm i @clerk/localizations@3.6.2-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@6.3.2-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.15.4-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/remix

npm i @clerk/remix@4.2.50-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/clerk-sdk-node

npm i @clerk/clerk-sdk-node@5.0.63-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/shared

npm i @clerk/shared@2.12.2-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/tanstack-start

npm i @clerk/tanstack-start@0.4.26-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/testing

npm i @clerk/testing@1.3.24-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/themes

npm i @clerk/themes@2.1.44-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/types

npm i @clerk/types@4.32.1-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/ui

npm i @clerk/ui@0.1.19-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@clerk/vue

npm i @clerk/vue@0.0.3-snapshot.v123daa6313f2072c93583786a79ceb2b02cb68c9 --save-exact

@anagstef anagstef changed the title fix(clerk-expo): Stop silencing network errors when on Expo fix(clerk-js,types): Introduce experimental.rethrowOfflineNetworkErrors Clerk option to enable rethrowing network errors Nov 12, 2024
@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.4.10-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/backend 1.16.2-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/chrome-extension 1.3.33-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/clerk-js 5.33.1-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/elements 0.19.2-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/clerk-expo 2.3.2-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/expo-passkeys 0.0.4-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/express 1.3.12-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/fastify 2.0.14-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/localizations 3.6.2-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/nextjs 6.3.2-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/clerk-react 5.15.4-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/remix 4.2.50-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/clerk-sdk-node 5.0.63-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/shared 2.12.2-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/tanstack-start 0.4.26-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/testing 1.3.24-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/themes 2.1.44-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/types 4.32.1-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/ui 0.1.19-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c
@clerk/vue 0.0.3-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c

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

npm i @clerk/astro@1.4.10-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/backend

npm i @clerk/backend@1.16.2-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@1.3.33-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.33.1-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/elements

npm i @clerk/elements@0.19.2-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@2.3.2-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/expo-passkeys

npm i @clerk/expo-passkeys@0.0.4-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/express

npm i @clerk/express@1.3.12-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/fastify

npm i @clerk/fastify@2.0.14-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/localizations

npm i @clerk/localizations@3.6.2-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/nextjs

npm i @clerk/nextjs@6.3.2-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.15.4-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/remix

npm i @clerk/remix@4.2.50-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/clerk-sdk-node

npm i @clerk/clerk-sdk-node@5.0.63-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/shared

npm i @clerk/shared@2.12.2-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/tanstack-start

npm i @clerk/tanstack-start@0.4.26-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/testing

npm i @clerk/testing@1.3.24-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/themes

npm i @clerk/themes@2.1.44-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/types

npm i @clerk/types@4.32.1-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/ui

npm i @clerk/ui@0.1.19-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

@clerk/vue

npm i @clerk/vue@0.0.3-snapshot.vb069571c43a1227a1da0d7e0baafaab7745d760c --save-exact

Comment on lines 2 to 3
'@clerk/clerk-js': patch
'@clerk/types': patch
Copy link
Member

Choose a reason for hiding this comment

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

I'd do a minor, because we are adding to the public api

@anagstef anagstef merged commit 6217a3f into main Nov 13, 2024
24 checks passed
@anagstef anagstef deleted the stefanos/eco-230-propagate-network-errors-when-on-expo-instead-of-muting-them branch November 13, 2024 15:16
wobsoriano pushed a commit that referenced this pull request Feb 8, 2025
…ors` Clerk option to enable rethrowing network errors (#4525)
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