clerk / javascript

Official JavaScript repository for Clerk authentication
https://clerk.com
MIT License
1.14k stars 260 forks source link

@clerk/clerk-expo throws an error expo-web #1608

Closed suchcodemuchwow closed 1 year ago

suchcodemuchwow commented 1 year ago

Package + Version

Dependencies + versions

Provide a json with the dependencies used in your project (copy paste from yarn.lock / package-lock.json) or a github project / template that reproduces the issue.

*Include the @clerk/ packages and their versions!**

Example:

{  

  "dependencies": {
    "@clerk/clerk-expo": "^0.18.17",
    "@expo/vector-icons": "^13.0.0",
    "@react-navigation/native": "^6.0.2",
    "expo": "~49.0.7",
    "expo-font": "~11.4.0",
    "expo-linking": "~5.0.2",
    "expo-router": "2.0.0",
    "expo-secure-store": "^12.3.1",
    "expo-splash-screen": "~0.20.5",
    "expo-status-bar": "~1.6.0",
    "expo-system-ui": "~2.4.0",
    "expo-web-browser": "~12.3.2",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.72.3",
    "react-native-gesture-handler": "~2.12.0",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-web": "~0.19.6"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/react": "~18.2.14",
    "jest": "^29.2.1",
    "jest-expo": "~49.0.0",
    "react-test-renderer": "18.2.0",
    "typescript": "^5.1.3"
  },
}

Description

I was trying to use Clerk with expo-router, based on this tutorial it throws a cryptic error which was not clear. Removing clerk solved the issue then looking at stack trace I found this:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'decode')
    at new URLStateMachine (url-state-machine.js:544:31)
    at module.exports.basicURLParse (url-state-machine.js:1261:12)
    at new URLImpl (URL-impl.js:19:70)
    at Object.setup (URL.js:74:28)
    at new URL (URL.js:106:8)
    at _IsomorphicClerk.get (isomorphicClerk.js:426:62)
    at _IsomorphicClerk.<anonymous> (isomorphicClerk.js:440:5)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (asyncToGenerator.js:5:19)
    at _next (asyncToGenerator.js:24:7)

The error is not thrown in expo ios but only in expo web

Reproducible Demo: https://github.com/Galaxies-dev/react-native-clerk-auth Just install deps and npm run web

jescalan commented 1 year ago

Hey @suchcodemuchwow - thank you so much for sending over this issue and for the reproduction. We are going to look into this as soon as we can!

johnjensenish commented 1 year ago

This issue was fixed in @clerk/clerk-expo@0.19.4. Now I'm seeing #1792 (though I'm not the OP).

dimkl commented 1 year ago

Hello @suchcodemuchwow, could you verify that the issue is resolved in @clerk/clerk-expo@0.19.4?

suchcodemuchwow commented 1 year ago

I will check&update, thanks 🙂

suchcodemuchwow commented 1 year ago

Thank you Clerk folks, it's solved with version @clerk/clerk-expo@0.19.4. You can close this issue

clerk-cookie commented 1 month ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.