MetaMask / snaps

Extend the functionality of MetaMask using Snaps
https://metamask.io/snaps/
Other
733 stars 562 forks source link

[TypeError: Cannot delete property 'dispose' of function Symbol() { [native code] }] #2328

Open anhdungle93 opened 7 months ago

anhdungle93 commented 7 months ago

Hi,

I am building a snap, but encountered a problem after yarn build

(node:90980) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Bundle Warning: Processing of the Snap bundle completed with warnings.
`Math.random` was detected in the bundle. This is not a secure source of randomness.
Build success: 'src/index.ts' bundled as 'dist/bundle.js'!
Removing intrinsics.Map.groupBy
Removing intrinsics.Object.groupBy
Removing intrinsics.Symbol.dispose
failed to delete intrinsics.Symbol.dispose [TypeError: Cannot delete property 'dispose' of function Symbol() { [native code] }]
[TypeError: Cannot delete property 'dispose' of function Symbol() { [native code] }]
Error: Snap evaluation error: Process exited with non-zero exit code: 255
    at evalHandler (/Users/anhdungle/learning/galactica/galactica-monorepo/node_modules/@metamask/snaps-cli/dist/cmds/eval/evalHandler.js:21:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async build (/Users/anhdungle/learning/galactica/galactica-monorepo/node_modules/@metamask/snaps-cli/dist/cmds/build/buildHandler.js:30:9)
FrederikBolding commented 7 months ago

@anhdungle93 What version of Node are you using and what version of the Snaps CLI? 👀

anhdungle93 commented 7 months ago

My node version is v21.0.0 and snaps-cli is 0.32.2. When I tried with newer snaps-cli version 6.1.0 I got

... Error: Failed to evaluate snap bundle in SES. This is likely due to an incompatibility with the SES environment in your snap.
Received the following error from the SES environment:

[TypeError <Object <Object <[Object: null prototype] {}>>>: Cannot read properties of undefined (reading 'browser')
    at 4417 (eval at <anonymous> (eval at makeEvaluate (/Users/anhdungle/learning/galactica/galactica-monorepo/node_modules/@metamask/snaps-cli/node_modules/ses/dist/ses.cjs:6394:27)), <anonymous>:1:4038574)
    at c (eval at <anonymous> (eval at makeEvaluate (/Users/anhdungle/learning/galactica/galactica-monorepo/node_modules/@metamask/snaps-cli/node_modules/ses/dist/ses.cjs:6394:27)), <anonymous>:1:4244351)
    at 8908 (eval at <anonymous> (eval at makeEvaluate (/Users/anhdungle/learning/galactica/galactica-monorepo/node_modules/@metamask/snaps-cli/node_modules/ses/dist/ses.cjs:6394:27)), <anonymous>:1:500067)
    at c (eval at <anonymous> (eval at makeEvaluate (/Users/anhdungle/learning/galactica/galactica-monorepo/node_modules/@metamask/snaps-cli/node_modules/ses/dist/ses.cjs:6394:27)), <anonymous>:1:4244351)
    at eval (eval at <anonymous> (eval at makeEvaluate (/Users/anhdungle/learning/galactica/galactica-monorepo/node_modules/@metamask/snaps-cli/node_modules/ses/dist/ses.cjs:6394:27)), <anonymous>:1:4248395)
    at eval (eval at <anonymous> (eval at makeEvaluate (/Users/anhdungle/learning/galactica/galactica-monorepo/node_modules/@metamask/snaps-cli/node_modules/ses/dist/ses.cjs:6394:27)), <anonymous>:1:6913874)
    at Object.eval (eval at <anonymous> (eval at makeEvaluate (/Users/anhdungle/learning/galactica/galactica-monorepo/node_modules/@metamask/snaps-cli/node_modules/ses/dist/ses.cjs:6394:27)), <anonymous>:1:6913980)
    at Object.eval (eval at makeEvaluate (/Users/anhdungle/learning/galactica/galactica-monorepo/node_modules/@metamask/snaps-cli/node_modules/ses/dist/ses.cjs:6394:27), <anonymous>:12:22)]

    at evaluate (/Users/anhdungle/learning/galactica/galactica-monorepo/node_modules/@metamask/snaps-cli/dist/chunk-MUYXNION.js:13:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.task (/Users/anhdungle/learning/galactica/galactica-monorepo/node_modules/@metamask/snaps-cli/dist/chunk-C2OMV3H5.js:47:7)
    at async executeSteps (/Users/anhdungle/learning/galactica/galactica-monorepo/node_modules/@metamask/snaps-cli/dist/chunk-XGWLFH7Y.js:23:7)
    at async buildHandler (/Users/anhdungle/learning/galactica/galactica-monorepo/node_modules/@metamask/snaps-cli/dist/chunk-C2OMV3H5.js:53:10)
...
weilun0510 commented 5 months ago

Solve it?