0

I am deploying a react app that uses some Solana packages and the app is breaking with the following type error:

Uncaught TypeError: Cannot convert a BigInt value to a number
    at Math.pow (<anonymous>)
    at 8953 (main.78866a30.js:2:547022)
    at __webpack_require__ (main.78866a30.js:2:1792446)
    at main.78866a30.js:2:2149776
    at main.78866a30.js:2:2514541
    at main.78866a30.js:2:2514545

I spent a little bit of time looking at the compiled javascript and found some instances of Math.pow that could cause this error, like here for example:

  C = BigInt(Math.pow(2, 32) - 1),
          P = BigInt(32);
        function T(e) {
          var t =
            arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
          return t
            ? { h: Number(e & C), l: Number((e >> P) & C) }
            : { h: 0 | Number((e >> P) & C), l: 0 | Number(e & C) };
        }

I'm assuming it's a Solana package because the surrounding code is hashing and digest functions. Is there any way to figure out which package this code is coming from? Or any other quick fixes?

2 Answers 2

1

add a

.env

in your src folder. There add

GENERATE_SOURCEMAP=false

That worked for me.

0
0

This sounds like you are either using too big of a bigint value or you are passing a bigint where you meant to pass a number. This is not common so check your types and convert to typescript if possible to catch these kind of errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.