How to fix this error using getNFTsForContract

How to fix this error

//setting moralis

REACT_APP_MORALIS_APPLICATION_ID = “VvHS4AuWP8LqTzM0uFOrk50FlgWeJbMqt73bab3j”
REACT_APP_SERVER_URL = “https://ajam9m7mw5gd.usemoralis.com:2053/server

//call getNFTsForContract function

const nfts = async () => {

console.log(account)

console.log(ContractAddressByRinkeby)

const options = {

  chain: "ropsten",

  address: account,

  token_address: ContractAddressByRinkeby,

};

console.log(account, ContractAddressByRinkeby)

console.log("---moralis---->")

const result = await Web3Api.account.getNFTsForContract(options);

console.log("result-->", result);

return result

}

////////////////////////
But it shows this error.

—moralis---->
xhr.js:210 POST https://ajam9m7mw5gd.usemoralis.com:2053/server/functions/getNFTsForContract net::ERR_CONNECTION_TIMED_OUT

createError.js:16 Uncaught (in promise) Error: Network Error
at createError (createError.js:16:1)
at XMLHttpRequest.handleError (xhr.js:117:1)

///////////// what’s wrong with it?
Please help me asap.
Thanks. John

did you try multiple times? you get same error?
something else works fine with that server? like a different web3api function
maybe it could also depend on the parameters that you give to that function

I called it multiple times. but I always get the error.
It shows also for other web3api function
what wrong with it?

//////////
image


///error
image

in that error it seems like it tries to access a different server url than what is in config
you can also check if you have vpn that block that connection

Hi cryptokid.
Thanks for your help.
But I’ve used several times in the last week.
Today it takes errors.
I’ve only change network from rinkeby to ropsten in the code .

can you change the network back to see if it works?

can you try in admin interface in web3api page with same parameters to see if it works there?

I try a server update now

@apollo12 have you tried to console.log() your “REACT_APP_MORALIS_APPLICATION_ID” & “REACT_APP_SERVER_URL”? See if it’s actually returning the actual .env variables.

Because AFAIK, you need dotenv package for process.env to work correctly.

This is not a problem with your web-browser, but usually it means that there are problems at the client side, such as internet connection issues or an issue with the server where your site is hosted. This error means that your web-server request take too much time and so your internet browser timed-out the current connection. When a request is sent to the web-server , and it does not respond within 30 seconds, then the browser terminates the communication attempt. Another reason could be the firewall preventing Google Chrome to load the webpage. Also in those cases, you received the error and it says This site can’t be reached. Rebooting your modem or router generally solves this issue and then you can connect to the website. Try the following simple solutions in the order in which they are listed.

  • Clear Browser Cache
  • Check your Security programs
  • Restart your router
  • Disable Proxy Settings

Moreover, to ensure that the web service is running normally, if it is running normally, check whether the 80 port rule exists, and if the server operator has a security group policy, you also need to add the release 80 port.