It was working perfectly fine, then I opened this project a month later, and now it’s throwing me an error that “chain must be a valid enum value”.
return new CoreError({
^
MoralisError [Moralis SDK Core Error]: [C0006] Request failed, Bad Request(400): chain must be a valid enum value
at RequestController.makeError (C:\Users\yuvir\Desktop\DEV\WEB 3.0\PayMate\server\node_modules\@moralisweb3\common-co
re\lib\cjs\index.cjs:1224:20)
at RequestController.<anonymous>
I am using the latest SDK “^2.26.1” .
I’ve rechecked my moralis API_KEY a thousand times.
Can’t seem to understand what’s the issue here.
app.get("/getNameAndBalance", async (req, res) => {
const { userAddress } = req.query;
const response = await Moralis.EvmApi.utils.runContractFunction({
chain: "0x13881", // hex index for the mumbai testnet
address: "smart-contract-address", //smart contract address
functionName: "getMyName",
abi: ABI,
params: { _user: userAddress },
});
This is what I’m trying to do.