Video Tutorial Clone Rarible part 8: the columns for the cloud function do not appear

Hi guys

I am following the tutorial to clone Rarible and until it was necessary to work with the Cloud Functions everything was fine and everything worked perfectly as from the videos.

In practice, the columns on the left do not appear in the database and specifically: EthNFTTokenOwners rather than EthTokenBalance.

Having said that, the columns inside the table do not even appear such as: token_uri, symbol, id and all the others necessary to perform the cloud function.

I attach here the screen that I see in the database.

Would anyone know how to help me?

Hi dipi5 !
In your cloud function, you must replace “EthNFTTokenOwners” now by “EthNFTOwners” :

const query = new Moralis.Query("EthNFTOwners");

Moralis is fantastic but this is the main problem i have noticed so far : the syntax/labels/keywords spelling is reformed way too often making headaches and burnout for a lot of people.
If it doesn’t work, you should share your entire cloud function code.
(I deleted my previous post because my comment formating was not OK. I’m new too on this forum)

1 Like

Thanks a lot for reply. However I think problem is before cloud function due database doesn’t display EthTokenOwner and on any table I don’t see strings as: symbol, token_uri, token_address and others

I read somewhere that this variables appear automatically when I mint an NFT but It’s not so to me

However this is cloud function code:

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

    const query = new Moralis.Query("EthNFTOwners");
    query.equalTo("contract_type", "ERC721");
    query.containedIn("owner_of", request.user.attributes.accounts);
    const queryResults = await query.find();
    const results = [];
    for (let i = 0; i < queryResults.length; ++i) {
      results.push({
        "tokenObjectId": queryResults[i].id,
        "tokenId": queryResults[i].attributes.token_id,
        "tokenAddress": queryResults[i].attributes.token_address,
        "symbol": queryResults[i].attributes.symbol,
        "tokenUri": queryResults[i].attributes.token_uri,
      });
    }
    return results;
  });

dipi5,
you have a mistake in your cloud function code, under results.push(). Instead of :
"tokenObjectId": queryResults[i].id,
… you must write :
"id": queryResults[i].attributes.objectId,

You can verify it on the video part 8 at minute 12’30".

Try to mint a new NFT and let met know if this time it works. If not, i would like to know if you use ganache as a local blockchain.
(sorry for not answering earlier, i have a job beside this Moralis hobby ahahahah)

I have also found a mini-mistake but i think it is not relevant for the code to work properly. Always in the results.push() function, you wrote :
"tokenId": queryResults[i].attributes.token_id,
… but if you really want to respect the code as displayed in the video, you should write :
"tokenid": queryResults[i].attributes.token_id,

I made the same mistake than you the first time because i wanted to respect the spelling logic (ex: in the video, it is “tokenAddress” and not “tokenaddress”. But, i don’t know why, Niklas wrote “tokenid” instead of “tokenId”. I suggest you to reproduce this same “”“mistake”"" in order to be sure all your scripts work perfect all together.

Don’t worry, I know ahaha

However I’ve just tried but I have the same problem

OK, if it does not work yet, no problem. I think it’s normal :
if you have made some errors during typing your code, video after video, it is most likely normal the Moralis database does not respond properly yet. I’m going to give you an advice i found and that worked great for me. It is a bit annoying to do it but this is the only solution.

First, i wanted to know if you work on a local blockchain such as Ganache ?
If you use ganache, like me, and if you are now 100% sure there is no mistake in your website* (folders “frontend” + "contracts), then do as following :
1- don’t do any change for now in your website’s scripts.
2- empty your ganache server (delete any existing server you may have) and re-create a new ganache server for this tutorial.
3- delete your Moralis server and recreate it.
4- when you have a brand new ganache server + a brand new Moralis server, launch your website, connect your wallet and mint an NFT.

It really worked for me. It looks like if you have made some errors in your websites’ script (and/or your Moralis server), then some database tables (on Moralis) may have been created and populated properly but some other tables didn’t (remember your could function mistake). IF you reload with brand new servers, then your tables should all be properly created and populated.

Also, another advice i have readen on this forum :
when you develop such a project, it is highly recommanded to have only 1 server created in ganache for your project. Because if you have several servers, this can create problems. For example, in my ganache, i had 3 servers : “sam_demo_1”, “sam_demo_2”, etc… But sometimes, when restarting a ganache server (to refresh new blocks i could not see), i was clicking on a wrong server and then starting to interact with moralis. This kind of error can start to store data on Moralis but ending with an error due to no response from ganache… and then we go again for new problems. I have readen that some database tables on Moralis can be “corrupted” due to this wrong manipulation. Believe me: one day i was totally sure my code was clean but i could not see a good reaction on Moralis. When i restarted ganache and Moralis from scratch, everything was working fine for me :wink:

If it does not work, then i think you have a problem in your website’s script. Then you should post your main.js + contracts script here. I hope a Moralis moderator can take a look on it. I will stay online to keep up with you.

Success ! (and Happy new year, by the way !!)

The issue is Moralis made a new upgrade and those tables have disappeared, that tutorial is no longer valid and you need to report in the discord on how to use the API instead

Lots of upgrades, yes, but i succeeded to go till part 14. I can create NFTs, get them listed in Moralis. I can even post an NFT in my marketplace. I think this tutorial still doable even if outdated, dont’ you think?

Thanks so much. So I tried to delete Ganache, deleted all Moralis servers and created a new one.

Now I have connected the new server on main.js. Then I created a new Ganache server, ran everything in the Moralis Devchain Proxy Server section and ran “frpc.exe -c frpc.ini”.

So far everything okay so I start the first procedure, to internderci “truffle migrate” and I have these problems:

-Devchain Proxy Server doesn’t make me change status in Connecting
-The terminal then reports me these errors:> Compiled successfully using:

  • solc: 0.8.11 + commit.d7f03943.Emscripten.clang

Something went wrong while attempting to connect to the network at http://127.0.0.1:7545. Check your network configuration.

Could not connect to your Ethereum client with the following parameters:
- host> 127.0.0.1
- port> 7545
- network_id> 5777
Please check that your Ethereum client:
- is running
- is accepting RPC connections (i.e., “–rpc” or “–http” option is used in geth)
- is accessible over the network
- is properly configured in your Truffle configuration file (truffle-config.js)

Truffle v5.4.28 (core: 5.4.28)
Node v16.13.1

At this point Ganache disconnects.

I really don’t know what to do

Hi Davis

So, I answer here so it might help other people here in the community as well.

I did exactly as you said:

  1. Eliminated all Ganache servers
  2. Eliminated all Moralis servers
  3. Created a new Moralis server and connected inside main.js
  4. Created a new Ganache server and started
  5. Run “Truffle migrate” again and create a new NFT for testing

Everything went perfectly and it seems to have also solved the problem now with the Clou Fuction to call up the display of items in “my items”.

Thank you very much, you have been very helpful to me!