Skip to content

fix(clerk-expo): Use atob polyfill when using Hermes JS engine - #3354

Merged
nikosdouvlis merged 1 commit into
mainfrom
george/sdk-1733-expo-51-breaks-with-atob-usage
May 10, 2024
Merged

fix(clerk-expo): Use atob polyfill when using Hermes JS engine#3354
nikosdouvlis merged 1 commit into
mainfrom
george/sdk-1733-expo-51-breaks-with-atob-usage

Conversation

@desiprisg

@desiprisg desiprisg commented May 9, 2024

Copy link
Copy Markdown
Contributor

Description

Use a polyfill for the atob function to prevent errors when using the Hermes JS engine, since the 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: facebook/hermes#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

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

@changeset-bot

changeset-bot Bot commented May 9, 2024

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7e206ff

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

@desiprisg desiprisg self-assigned this May 9, 2024
Comment thread packages/expo/src/polyfills/base64Polyfill.ts
@nikosdouvlis

Copy link
Copy Markdown
Member

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

@desiprisg
desiprisg force-pushed the george/sdk-1733-expo-51-breaks-with-atob-usage branch from 2bd767b to 8da6f50 Compare May 10, 2024 09:31
@desiprisg desiprisg changed the title fix(clerk-expo): Use atob polyfill by default fix(clerk-expo): Use atob polyfill when using Hermes JS engine May 10, 2024
@desiprisg

Copy link
Copy Markdown
Contributor Author

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

@fredrikburmester

Copy link
Copy Markdown

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!

Comment thread packages/expo/src/polyfills/base64Polyfill.ts
@desiprisg
desiprisg force-pushed the george/sdk-1733-expo-51-breaks-with-atob-usage branch from 8da6f50 to 7e206ff Compare May 10, 2024 11:42
@desiprisg

Copy link
Copy Markdown
Contributor Author

!snapshot

@clerk-cookie

Copy link
Copy Markdown
Collaborator

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/clerk-expo@1.0.8-snapshot.v7e206ff --save-exact

gatsby-plugin-clerk

npm i gatsby-plugin-clerk@5.0.0-beta.45 --save-exact

@anagstef anagstef left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💯

@nikosdouvlis
nikosdouvlis merged commit 48985ab into main May 10, 2024
@nikosdouvlis
nikosdouvlis deleted the george/sdk-1733-expo-51-breaks-with-atob-usage branch May 10, 2024 11:58
@clerk-cookie clerk-cookie mentioned this pull request May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants