nft.getWalletNFTs [C0008] Default instance of Core is not set

Hi!

I’m trying to get all NFTs from a wallet using Moralis.EvmApi.nft.getWalletNFTs and it worked fine for a while but new I keep getting

MoralisError [Moralis SDK Core Error]: [C0008] Default instance of Core is not set

when using response.result.

I’m running my code server-side on NodeJS and based my code on this documentation: https://docs.moralis.io/web3-data-api/evm/reference/get-wallet-nfts

Setup:

NodeJS v18.11.0

dependencies: {
   '@moralisweb3/common-evm-utils': 2.16.1
   moralis: 2.14.3
}

Code:

import Moralis from "moralis";

...

if (!Moralis.Core.isStarted) {
   await Moralis.start({
      apiKey: MORALIS_API_KEY,
   });
}

const response = await Moralis.EvmApi.nft.getWalletNFTs({
   chain:"0x13881",
   format: "decimal",
   "0x...",
});

console.log(response.result);

This returns the following error:

MoralisError [Moralis SDK Core Error]: [C0008] Default instance of Core is not set
isMoralisError: true,
code: 'C0008',
details: undefined,
[cause]: undefined

Any ideas?

UPDATE:

If I use response.toJSON().result instead then it seems to work but shouldn’t response.result just work? I mean, it was working before!! :thinking:

Hi @thomasv

So have you fixed the error?

response.result should also work as expected. Make sure you are using the latest SDK version.

Hey @johnversus.

I use the toJSON() workaround still so I can’t say it’s “fixed” no.
And I updated the packages so fairly sure I use the latest SDK version.

Hi @thomasv

I am not able to reproduce this error with the code which you share previously.
If you think some other part of the code this throwing the error, can you try sharing it so I can try to reproduce it on my end and can share the same with the devs?

Thanks