It seems overnight I have an issue. Iāve had no issue with this Dapp for the past couple of weeks yesterday I was unable to retrieve any of the NFTs that the current user owns from my Dapp contract, now today I can no longer fetch those owned NFTs nor any NFTs within the contract. I have updated my server, Moralis SDK, and web 3 dist packages. to no avail, my next step will be to create a new server and try again but I donāt want to redeploy this contract which Iām able to interact with fine. I did upgrade my server to proā¦not sure if this may be causing the error. Console says itās a Moralis error, I tried the solution that has worked for others, still not functioning properly. However, if I refresh a bunch of times sometimes My NFTs will appear.
my server: https://n9z8d6wmje7i.usemoralis.com:2053/server
appId: Rs074bIe78OjHjWuKC9qZFBM30hOHY4aGqu25vMN
contract: 0xe7430180aEC2d17EEbDb78a7aEeAF9C88312a573
using: [email protected] and [email protected]
Server: 0.0.281
javascript code where error appears:
async function getUserData(){
let accounts = currentUser.get('accounts');
const options = {chain: 'mumbai', address: accounts[0], token_address: CONTRACT_ADDRESS};
//return Moralis.Web3API.account.getNFTsForContract(options)
return Moralis.Web3API.account.getNFTsForContract(options)
.then( (data) => {
let result = data.result.reduce( (object, currentElement) => {
object[currentElement.token_id] = currentElement.amount;
return object;
}, {})
return result;
});
}
init = async () => {
await Moralis.start({ serverUrl, appId });
currentUser = await Moralis.User.current();
wallet = currentUser;
let ownedNFTs = [];
//web3 = await Moralis.Web3.enable();
web3 = await Moralis.enableWeb3();
if(!currentUser){
window.location.pathname = "./dist/beta.html";
}
const options = {address: CONTRACT_ADDRESS, chain: "mumbai"};
let NFTs = await Moralis.Web3API.token.getNFTOwners(options);
for(let i = 0; i < NFTs.result.length; i++){
if(NFTs.result[i].owner_of == wallet.attributes.accounts[0]){
ownedNFTs.push(NFTs.result[i]);
}
}
let userData = await getUserData();
await getCollection(ownedNFTs, userData);
}