Runcontractfunction error on custom server

I am having unauthorized error while using runcontractfunction, how can I make authorized call using this function to my custom server?

Hi, can you let us know what is the full error? and how are you running the function?

const ops = {
address: options.address,
functionName: “isNFTDomainReserved”,
chain: “0x1”,
abi: contractABIJson,
params: {

await Moralis.Web3API.native.runContractFunction(ops).then((res) => {....

This was working when my server was on moralis, now I have shifted it to custom server, and it gives
this error in picture…

Hey @sahkoh,

Did you check whether you have loaded your API key into the env variable properly? Unauthorized mainly means that your API key does not exist or is not valid.

Yeah, Key is there, If I authenticate using metamask, then call this function it works fine, but If its not authenticated using meta, it throws error,
this happened after I shifted it to custom server, before it was on moralis server and it worked find for both cases

Hey @sahkoh,

What are you authenticating it with that does not work? That shouldn’t be the case since the APIs should work without any kind of authentication

Exactly, That’s what I am asking what can I do make this call successful ?

Hmmm do you receive any error on your custom server when you get this error? See if any log?

There is no logs error in the server. only on the frontend side, that I shared above

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.