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

Production build error: Can't convert a BigInt value to a number #304

Open
djimenezdev opened this issue Apr 1, 2023 · 4 comments
Open
Labels

Comments

@djimenezdev
Copy link

djimenezdev commented Apr 1, 2023

Hey everyone! So I am using this library to generate the signature for a meta gasless transaction for a mini game I building. And it works perfectly on localhost but when I generate the build folder and use the serve library to run this build folder on a local server I get this Cannot convert a BigInt value to a number error as seen below:

cannotConvert

I also get some warnings when I run the react app using the start command provided by the react-app. I don't know if they have anything to do with it but I'll show a few I am getting below

warnings

Also the react app is built with create-react-app and is using react version ^18.2.0

@djimenezdev
Copy link
Author

I created a fresh react-app only installing the @metamask/eth-sig-util lib and I simply just import the signTypedData function without even implementing it and I get that exact same error just like in my actual project I am building

@djimenezdev djimenezdev changed the title Cannot convert a BigInt value to a number Production build error: Can't convert a BigInt value to a number Apr 3, 2023
@nenadV91
Copy link

I've faced the same issue

@keithchew
Copy link

Hi

You might want to take a look at:

#298

to see if pinning to v4.0.1 helps.

@mcmire mcmire added the bug label Nov 7, 2023
@legobeat
Copy link
Contributor

legobeat commented Nov 21, 2023

@djimenezdev @nenadV91 Would you be able to try either of v6.0.2 or v7.0.1 and see if the issue persists?

Note that in general, many BigNumber instances are not safe to call toNumber() on since JavaScript number can not fit some values. In particular, users should ensure they aren't using older versions of web3, which are affected by this.

If you are a web3.js user,

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

No branches or pull requests

5 participants