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

field.replaceAll is not a function error with recent versions #2554

Closed
Aniket-Engg opened this issue Feb 27, 2023 · 5 comments · Fixed by #2555
Closed

field.replaceAll is not a function error with recent versions #2554

Aniket-Engg opened this issue Feb 27, 2023 · 5 comments · Fixed by #2555

Comments

@Aniket-Engg
Copy link
Contributor

Aniket-Engg commented Feb 27, 2023

        .replaceAll(/[^0-z]/g, "")
         ^

TypeError: field.replaceAll is not a function
    at Object.snake (remix-project/dist/libs/remix-tests/node_modules/@chainsafe/ssz/lib/util/strings.js:7:10)
    at Object.eth2 (remix-project/dist/libs/remix-tests/node_modules/@chainsafe/ssz/lib/util/strings.js:28:35)
    at precomputeJsonKey (remix-project/dist/libs/remix-tests/node_modules/@chainsafe/ssz/lib/type/container.js:409:40)
    at new ContainerType (remix-project/dist/libs/remix-tests/node_modules/@chainsafe/ssz/lib/type/container.js:32:26)
    at Object.<anonymous> (remix-project/dist/libs/remix-tests/node_modules/@ethereumjs/tx/node_modules/@ethereumjs/util/dist/ssz.js:9:22)

With recent ethereumjs/util v8.0.4, @chainsafe/ssz dep is added which shows above error. It can be specific to node.js 14

@holgerd77
Copy link
Member

Hey @wemeetagain, do you know what is going on here? 🤔

Context is that we have now released a version of our libraries containing the @chainsafe/ssz dependency for the first time (we have this in @ethereumjs/util now to prepare for some SSZ withdrawal root functionality in the @ethereumjs/block library (which is still more or less unused, so in the worst case we could remove again for now).

So what happens here is that there is a replaceAll() call still in the library, which is ES2021 and therefore not compatible with Node 14 or many browsers. Looking at your library I see a build target of ES2019 in the package.json file (or is this the wrong one?), so I wonder why there is still a replaceAll() (from util/string.ts) in the distributed package?

Not sure if it's possible for you guys to do short-term fixing releases here, I guess otherwise we need to take the library out of our dependencies again and deactivate the released functionality (which wouldn't be such a big deal right now, since the usage of this functionality is still somewhat away. We should then exchange though if the underlying eventual build target issue can be mitigated mid-term).

@Aniket-Engg
Copy link
Contributor Author

Aniket-Engg commented Feb 27, 2023

As we were planning a release and this thing came out, we are exploring a tentative fix. Still, would like to have more info to fix it permanently

@holgerd77
Copy link
Member

We are on a fix, 80-95% work guarantee (PR in the works right now). I we can confirm we would release in the next 1-2 hours.

@holgerd77
Copy link
Member

Ok, released, could you confirm that (hopefully) things work again?

@Aniket-Engg
Copy link
Contributor Author

Yes, everything is fine again. Thank you so much for quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants