Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Magic SDK for React Native] Missing dependencies on Android build #131

Closed
phbdias opened this issue Sep 7, 2020 · 6 comments · Fixed by #132
Closed

[Magic SDK for React Native] Missing dependencies on Android build #131

phbdias opened this issue Sep 7, 2020 · 6 comments · Fixed by #132
Assignees
Labels
❓Question released This issue/pull request has been released.

Comments

@phbdias
Copy link

phbdias commented Sep 7, 2020

✅ Prerequisites

  • [✅] Did you perform a cursory search of open issues? Is this question already asked elsewhere?
  • [✅] Are you reporting to the correct repository (magic-sdk)?

❓ Question

I have been trying to integrate Magic SDK for React Native on a project, however I am struggling to get it to work properly.

When I build the app on an Android device, it fails with the following error: "Can't find variable: BigInt".
I managed to surpass this issue using a polyfill (i.e., inserting on global.js: global.BigInt = require('big-integer');).
However, another ReferenceError occurs ("Can't find variable: SharedArrayBuffer").
It is a configuration problem?

Thanks in advance for any help you are able to provide! :)

🌎 Environment

| Software | Version(s) |
| ---------------- : ---------- |
| "@magic-sdk/react-native": "^2.6.0" |
| "react": "16.13.1" |
| "react-native": "0.63.2" |
| "react-native-webview": "^10.8.2" |
| yarn: 1.22.5 |
| Operating System : Android 10 |

@prbdias
Copy link

prbdias commented Sep 9, 2020

It might be related with the fact that React Native runs on top of JavaScriptCore which doesn't have support yet for BigInt nor SharedArrayBuffer. In theory and assuming this is the root cause, the library might work just fine on Chrome but have similar issue on Safari which also runs on top of JavaScriptCore.
Would be interesting to understand which dependencies are using these unsupported native features.

@Ethella Ethella self-assigned this Sep 16, 2020
@Ethella
Copy link
Member

Ethella commented Sep 16, 2020

Hey @prbdias @phbdias, I'll take a closer look to see what's the missing pieces. Sorry for the late reply

@Ethella
Copy link
Member

Ethella commented Sep 18, 2020

Here's an update to it. One of our RN dependency whatwg-url has recently updated their minor version with a change of major version update of webidl-conversions. In this package, it uses BigInt which RN env does not support at the moment.

  • whatwg-url@^8.1.0
    • webidl-conversions “^5.0.0”
  • whatwg-url@^8.2.2
    • webidl-conversions@^6.1.0 (Use BigInt and Crashes)

I'll draft a quick fix to correct it. Thank you for your patience.

@Ethella
Copy link
Member

Ethella commented Sep 19, 2020

@prbdias @phbdias @magic-sdk/react-native@2.7.1 has been released to resolve the issue. Feel free to give it a try.

@prbdias
Copy link

prbdias commented Sep 19, 2020

@prbdias @phbdias @magic-sdk/react-native@2.7.1 has been released to resolve the issue. Feel free to give it a try.

@Ethella I've just tried and it's working like charm. 🎉🎉🎉

Thank you!

@smithki
Copy link
Contributor

smithki commented Oct 22, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓Question released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants