404 problem send data

I am trying to send the data that completes the character of each character, so it is not reflected and when reviewing the console it appears GET 404, I have currently addressed to my moral server and api but it claims me in the Abi of the promise.

Hi @artfortressonlinenft

Please share code, server url and give us as much info as possible :raised_hands:

it takes a long time to upload information or messages is there a more direct form of communication to send you a URL

JS… problem

@Yomoo
I send you the url so you can see my main.js file that has the problem when loading the data in the front, what other data do you need?

Instead of:

const appId = Moralis.initialize("ml9zwhpEX5E1WvMrff3AVFMOtIGbe4GBRMIbDMF8");
const serverURL = Moralis.serverURL = "https://9shql22goqah.usemoralis.com:2053/server";
//Moralis.start({ serverURL, appId });

Use this:

const appId = "ml9zwhpEX5E1WvMrff3AVFMOtIGbe4GBRMIbDMF8";
const serverURL ="https://9shql22goqah.usemoralis.com:2053/server";
Moralis.start({ serverURL, appId });

@Yomoo al hacer ese cambio

You have to use serverUrl instead of serverURL for that variable name

In

const serverURL ="https://9shql22goqah.usemoralis.com:2053/server";

You have to change it to serverUrl and use it with the new name in Moralis.start

1 Like

perfect …
when changing it he claims me through the web3,

you could try window.web3 = Moralis.enableWeb3()
instead of window.Web3 = await Moralis.Web3.enable(); that has a typo in window.Web3 instead of window.web3

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘contract’)
image

I can’t find a solution, is there any other way to call the contract?

It looks like you still have window.Web3 instead of window.web3

async function renderGame(){

$("#login_button").hide();

//get and render proper from SC

let petId = 0;

window.Web3 = await Moralis.Web3.enable();

let abi = await getAbi();

let contract = new web3.eth.contract(abi, CONTRACT_ADDRESS);

let array = await contract.methods.getAllTokensForUser(ethereum.selectedAddress).call({from: ethereum.selectedAddress});

if(array.length == 0) return;

array.forEach(async (petId) => {

    let details = await contract.methods.getTokenDetails(petId).call({from: ethereum.selectedAddress});

    renderPet(petId, details);

});

$("#game").show();

}

You have that line that has a typo

window.web3 = await Moralis.web3.enable();
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘enable’)

haha every time I modify something, something else is wrong

You had to change only the first web3 from that line not also the second one :slight_smile: you can try: window.web3 = Moralis.enableWeb3()

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘contract’)

image

again this is really frustrating

This is how you initialize contracts

const contract = new web3.eth.Contract(abi, contractAddress);

Also check the docs for the right syntax
Web3 - Contract - Moralis

the image appears the syntax as you send me the document, so I ask if there is a new way to call the contract I get an error that syntax

Please double check!
the first C in contract has to be in upper case and you need to add “new” before initialising a contract