NFTOwners is not working correctly for rinkeby testnet

Here is the cloud function definition

Moralis.Cloud.define("getUserNFTs", async (request) => {
  const {userAddress} = request.params;
  const BscQuery = new Moralis.Query("BscNFTOwners");

  BscQuery.equalTo("owner_of", userAddress);
  const BSCResults = await BscQuery.find({useMasterKey : true});

  const EthQuery = new Moralis.Query("EthNFTOwners");
  const EthResults = await EthQuery.find({useMasterKey : true});

  const result = {BscNFTs: BSCResults, EthNFTs: EthResults}
  return result;
});

const result = await Moralis.Cloud.run('getUserNFTs, {userAddress: β€œ0x…” })
Expected result length should be 167
But returns empty array

Hey @johncarter

Please share your server subdomain :raised_hands:

https://sv8erjsrz4wg.bigmoralis.com:2083/

It works correctly actually. The problem is that you are trying to query the empty database:

image

Take a look at how do queires work in the docs

To query something you need to add the info to the database before. You can authenticate via Moralis SDK or add addresses to watch manually:

This is not my expected result.
Screen Shot 2021-09-22 at 6.33.03 AM

How can we add a user to watch list? And what is the limit number?

I get the expected result with this function:

Moralis.Cloud.define("getUserNFTs", async (request) => {

  const BscQuery = new Moralis.Query("BscNFTOwners");
  BscQuery.equalTo("owner_of", request.params.address);
  const BSCResults = await BscQuery.find({useMasterKey : true});

  const EthQuery = new Moralis.Query("EthNFTOwners");
  const EthResults = await EthQuery.find({useMasterKey : true});

  const result = {BscNFTs: BSCResults, EthNFTs: EthResults}
  return result;
});

and called it this way: x = await Moralis.Cloud.run("getUserNFTs", {address: 'address_here'})

Note that I changed a line: BscQuery.equalTo("owner_of", request.params.address);
In your case you may use request.params.userAddress if you want to send the address with userAddress param name.

From a previous response, you see there in a print screen Sync And Watch Address where you can add an address to watch. I don’t think that it is a limit on how many addresses you can watch, but if you have a lot of data to add there, you may need to upgrade your Moralis server to be able to handle all that data.

One question.If we add an address by watchEthAddress, it’s not synced.

Why it’s different from one manually added. The last one is manually added.

Same problem now? nothing changed in that table with lots of undefined? Can you try to restart the server?