javascript icon indicating copy to clipboard operation
javascript copied to clipboard

fix(clerk-expo): Use atob polyfill by default

Open desiprisg opened this issue 1 year ago • 2 comments

Description

Use a polyfill for the atob function to prevent errors when using Expo Go 51, since the default engine's implementation is stricter than it should be and errors when the publishable key's base64 encoded part's length is not divisible by 4.

Related issue by the default JS engine for expo 51: https://github.com/facebook/hermes/issues/1379

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

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

desiprisg avatar May 09 '24 17:05 desiprisg

🦋 Changeset detected

Latest commit: 7e206ff3656560e724bb475b53c4dadb8c0500c8

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

This PR includes changesets to release 1 package
Name Type
@clerk/clerk-expo 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

changeset-bot[bot] avatar May 09 '24 17:05 changeset-bot[bot]

Can we detect the expo version used and polyfil for >51?

nikosdouvlis avatar May 09 '24 17:05 nikosdouvlis

Opted in checking for hermes and only applying the polyfill in that case. https://reactnative.dev/docs/hermes#confirming-hermes-is-in-use

desiprisg avatar May 10 '24 09:05 desiprisg

Just adding a comment to say that I got this error when using "@clerk/clerk-expo": "^1.0.7", in Expo 51.

 ERROR  Error: Not a valid base64 encoded string length

This error is located at:
    in ClerkProvider (created by RootLayout)

This PR seems to have solved my issue. Thanks!

fredrikburmester avatar May 10 '24 10:05 fredrikburmester

!snapshot

desiprisg avatar May 10 '24 11:05 desiprisg

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

Package Version
@clerk/clerk-expo 1.0.8-snapshot.v7e206ff
gatsby-plugin-clerk 5.0.0-beta.45

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

npm i @clerk/[email protected] --save-exact

gatsby-plugin-clerk

npm i [email protected] --save-exact

clerk-cookie avatar May 10 '24 11:05 clerk-cookie