Cloud functions - using bignumber on mainnet and testnet


I have 2 servers, 1 on mainnet and 1 on testnet and use the same cloud functions on both to test them

I am using web3 on cloud functions just for bignumber and nothing else

but if I use a mainnet chainId then I get {code: 141, error: “Could not find provider”} error on testnet version

const web3 = Moralis.web3ByChain(“0x38”);
const BN = web3.utils.BN;

yes it’s possible to upload different versions for both of them but I’m using the same codebase from cli so it’s easier to use exact same and not change it on every upload

is it possible to use bignumbers without choosing a target chain id? or is it possible to get the current server details on cloud functions so I can assign a testnet chainId or mainnet chainId depending on the current server dynamically?


I believe we have Moralis.Cloud.BigNumber you don’t need to choose the chain for that

awesome, didnt see it on the docs

1 Like