You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeError: Attempted to assign to readonly property.
ERROR Error: Requiring module "node_modules/ethjs/node_modules/ethjs-query/lib/index.js", which threw an exception: TypeError: Attempted to assign to readonly property.
ERROR TypeError: undefined is not a constructor (evaluating 'new (_$$_REQUIRE(_dependencyMap[0], "ethjs-query"))(cprovider, self.options.query)'
Error: Requiring module "node_modules/babel-runtime/regenerator/index.js", which threw an exception: TypeError: Attempted to assign to readonly property.
We have already removed the regenerator plugin. Investigating into the library, we found that it's referenced in its package.json. Further grepping show us more libraries with the same problem.
bentobox19
changed the title
Proof of Concept Insights - Attempt to assign a readnly property - Web3 Libraries using babel regenerator
Proof of Concept Insights - Attempt to assign a readonly property - Web3 libs using babel regenerator
Feb 26, 2022
PoC
https://github.com/LavaMoat/docs/blob/main/react-native-and-ses-lockdown.md
Discussion
One sample error obtained
Where is this
readonly property
?node_modules/ethjs/lib/index.js
which calls
node_modules/ethjs/node_modules/ethjs-query/lib/index.js
This is the first line of the file within the bundle. Let's call the
_$$REQUIRE()
function from the consoleThrows
We have already removed the regenerator plugin. Investigating into the library, we found that it's referenced in its
package.json
. Further grepping show us more libraries with the same problem.Proposed Solution
Patch some
eth
librariesTo the following files...
node_modules/ethjs/node_modules/ethjs-query/package.json
node_modules/ethjs-contract/package.json
node_modules/ethjs/node_modules/ethjs-contract/package.json
...Do the following change:
"main": "lib/index.js",
- >"main": "src/index.js",
And invoke
npx patch-package --exclude "nothing" <LIB_NAME>
.This flag
--exclude
is needed to be able to include thepackage.json
file into the patch.Items of Action
The text was updated successfully, but these errors were encountered: