externalGasLimit is invalid number value

Hi,

Recently, I deployed GSN contracts with AcceptEverythingPaymaster. I use default erc20 token (imported from openzeppelin) with gsn support - somewhat like in metacoin example.

When I try to mint token, I get this error:
Uncaught (in promise) Error: Failed to relay call. Results: Relaying errors (1): http://localhost:8090 => local view call to 'relayCall()' reverted: view call to 'relayCall' reverted in client: invalid number value (arg="externalGasLimit", coderType="uint256", value="12501891")

localhost:8090 is my relay server.

externalGasLimit is:
BN {negative: 0, words: Array(3), length: 2, red: null} length: 2 negative: 0 red: null words: (3) [38803601, 4, 0] [[Prototype]]: Object

externalGasLimit.toNumber() is:
307239057

This is info that I get in my metamask:

to:
0xab33cc08c0b775211a7a361d4369f36efeb4fb10
data:
0x40c10f19000000000000000000000000c3a8119e77803a306bcf250db89d9eed89842af3000000000000000000000000000000000000000000000000000000000000000a
from:
0xc3a8119e77803a306bcf250db89d9eed89842af3
value:
0
nonce:
0
gas:
35774
validUntil:
6097
relayData:
pctRelayFee:
70
baseRelayFee:
0
gasPrice:
23760000000
paymaster:
0x5261d1d9736BeA5ad86d0b7bDbe21c72B928132c
paymasterData:
0x
clientId:
1
forwarder:
0xAf0D8F3Bd5967F2764f60B78FC7a74076EF9e935
relayWorker:
0x0042fe9aedf95ff026d07a78bc5c734c1959bf65

All configurations are default as described in the docs.
Relay and provider versions are 2.2.6.

What can cause this error?
Thanks for help.

From what I found:
Looks similar to this issue.

I’ve tried to pass externalGasLimit in various types as an argument (to encodedRelayCall and tx after it in node_modules/@opengsn/common/dist/ContractInteractor.js from where the error actually comes).

In encodedRelayCall BN instance is not working, so I changed it to externalGasLimit.toString() and it works fine. Hex string is also works fine.

In tx parameters all options of gas parameter give me the same error “invalid externalGasLimit”

Don’t sure what the problem is.

After using proposed fixes, the error is:
execution reverted: local view call to 'relayCall()' reverted: view call to 'relayCall' reverted in client: {"code":-32603,"message":"Internal JSON-RPC error.","data":{"code":3, "message": invalid externalGasLimit","data":"0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000018696e76616c69642065787465726e616c4761734c696d69740000000000000000"}

Did you manage to fix the problem?