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

Uncaught Error: Attempting to define property on object that is not extensible (done.js: Promise.prototype.done) #25

Closed
leotm opened this issue Aug 28, 2023 · 2 comments
Labels
error build/run time blocker promise Promise polyfill

Comments

@leotm
Copy link
Member

leotm commented Aug 28, 2023

Triggered by disabling @babel/plugin-transform-runtime helpers in the preset

not blocking UI in JSC or V8

JSC (V8: error 2nd in stack)

Screenshot 2023-08-21 at 19 14 09

V8 only (error top of stack)

Screenshot 2023-08-28 at 15 30 29

(extended by Sentry spotted via debugging 14th caught exception)

Screenshot 2023-08-28 at 15 35 36

then the usual bubbling to metro-runtime/src/polyfills/require.js then promise/setimmediate/rejection-tracking.js

@leotm leotm added error build/run time blocker promise Promise polyfill labels Aug 28, 2023
@leotm leotm changed the title Uncaught Error: Attempting to define property on object that is not extensible (done.js) Uncaught Error: Attempting to define property on object that is not extensible (done.js: Promise.prototype.done) Aug 28, 2023
@leotm
Copy link
Member Author

leotm commented Aug 28, 2023

with current solution being to simply disable the single non-standard/deprecated Promise.prototype.done method polyfill/ext, found in: node_modules/promise/setimmediate/done.js
(originally added in then/promise@0498f7c)

it is not straight forward to determine where in RN source code this is required

Screenshot 2023-08-28 at 15 48 45

but disabling the file is sufficient

leotm added a commit to MetaMask/metamask-mobile that referenced this issue Aug 28, 2023
@leotm
Copy link
Member Author

leotm commented Aug 28, 2023

fixed in MetaMask/metamask-mobile@0286dfc

@leotm leotm closed this as completed Aug 28, 2023
leotm added a commit to MetaMask/metamask-mobile that referenced this issue Aug 30, 2023
- remove SES vetted shims implementation from entry file
- bake lockdown into RN
  - import [email protected]
  - import reflect-metadata (prior lockdown)
  - call lockdown (prior polyfillPromise, setUpXHR and setUpTimers)
  - (preserve polyfillPromise)
- update prev doc comments
- add detailed doc comments

Fix LavaMoat/docs#24
(Fix LavaMoat/docs#25)
Fix LavaMoat/docs#26

Next we can improve this implementation further with unreleased [email protected]
allowing for reflect-metadata as a vetted shim, rather than called prior lockdown
leotm added a commit to MetaMask/metamask-mobile that referenced this issue Sep 4, 2023
- remove SES vetted shims implementation from entry file
- bake lockdown into RN
  - import [email protected]
  - import reflect-metadata (prior lockdown)
  - call lockdown (prior polyfillPromise, setUpXHR and setUpTimers)
  - (preserve polyfillPromise)
- update prev doc comments
- add detailed doc comments

Fix LavaMoat/docs#24
(Fix LavaMoat/docs#25)

Partially fix LavaMoat/docs#26
(Unreleased) [email protected] is required for the full fix
Allowing for reflect-metadata as a vetted shim, rather than called prior lockdown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error build/run time blocker promise Promise polyfill
Projects
None yet
Development

No branches or pull requests

1 participant