Moralis.Plugins.opensea.getAsset working in testnet, not in mainnet

Hello, apologies in advance - total noob, but trying to find my way.
I’m using the OpenSea plugin, importing these libraries:

<script src=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/web3.min.js"
<script src=
"https://npmcdn.com/[email protected]/dist/moralis.js"
></script>

Also initialized serverUrl and appId according my account
In the OpenSea plugin configuration both Ethereum Mainnet and Rinkeby Speedy Node are set.

The getAsset API works for testnet, but not for mainnet.
I tried different assets from OpenSea production, won’t work.

Any configuration I might be missing? Also the fact that the exception is uncaught doesn’t help much ( For example, I noticed that if I use a nonexistent address in test produces the same error). Thanks in advance.

await Moralis.Plugins.opensea.getAsset({
  network: 'mainnet',
  tokenAddress: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d',
  tokenId: '8520',
});

Try with these updated scripts

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/web3.min.js"></script>
<script src="https://npmcdn.com/[email protected]/dist/moralis.js"></script>

Thanks! That 1.5.9 is supposedly the very last one, but just changed it regardless and no luck same result!

If I use the web3 nft APIs, I get a 200 result code with response body, so the address and id are correct, seemingly:

https://deep-index.moralis.io/api/v2/nft/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/8520?chain=eth&format=decimal

can you check the network tab for error description

1 Like

Full message too long, but it seems the relevant parts are:

{"code":141,"error":{"status":502,"headers":{"x-powered-by":"Express","access-control-allow-origin":"*","content-type":"application/json; charset=utf-8","content-length":"7491","etag":"W/\"1d43-iHhtNU98yK2NrmgrzWzCrIape5g\"","x-response-time":"1250.637ms","date":"Tue, 19 Apr 2022 16:48:37 GMT","connection":"close"}

"error\":true,\"data\":{\"code\":500001,\"message\":\"No asset found\",\"details\":{\"method\":\"getAsset\",\"network\":\"main\",\"tokenAddress\":\"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d\",\"tokenId\":\"8520\",\"error\":\"API Error 403: Unauthorized. Full message was '\\\"<!DOCTYPE html>\\\\n<html lang=\\\\\\\"en-US\\\\\\\">\\\\n <head>\\\\n <title>Access denied</title>

<span class=\\\"error-description\\\">Access denied</span>\\n <span class=\\\"code-label\\\">Error code <span>1020</span></span>\\n </h1>\\n <div class=\\\"large-font\\\">\\n <p>You do not have access to api.opensea.io.</p><p>The site owner may have set restrictions that prevent you from accessing the site. Contact the site owner for access or try loading the page again.</p>


under the network tab you will see an error description like this. can you share that.
image

Alright, here: similar to the pasted return code above -

It says “unauthorized”, does a different login/key/api/access is needed to access production OpenSea?

it looks like a rate limit error

you can get an API key from opensea, but I heard that it is not easy to get an API key now

Oh, I see - I guess I misunderstood and thought going through Moralis would prevent that from happening, but at the end of the day I suppose there are also limits on their side.