Weird errors building Dex

Hello! I am having a pretty hard time getting the Dex swap box options to show a list of available tokens. At first my server was stuck at 100% CPU, then it couldnt recognize the 1inch plugin, and now I am getting these errors when I inspect element on Live Server:

index.html:117 Live reload enabled.

iqvaw6azff7h.usemora…ns/getPluginSpecs:1 Failed to load resource: the server responded with a status of 400 ()

moralis.js:25632 Uncaught (in promise) Error: Invalid function: "getPluginSpecs" at handleError (moralis.js:25632)

iqvaw6azff7h.usemora…ns/getPluginSpecs:1 Failed to load resource: the server responded with a status of 400 ()

moralis.js:25632 Uncaught (in promise) Error: Invalid function: "getPluginSpecs" at handleError (moralis.js:25632)

I am not sure what this means I need to look at in my code. Here is my JS file:

/** Connect to Moralis server */
const serverUrl = "https://XYZ";
const appId = "ABC";
Moralis.start({ serverUrl, appId });

async function init(){
    await Moralis.initPlugins();
    await Moralis.enable();
    await listAvailableTokens();
}

async function listAvailableTokens(){
    const result = await Moralis.Plugins.oneInch.getSupportedTokens({
        chain: 'polygon',
      });
    const tokens = result.tokens;
    let parent = document.getElementById("token_list");
    for( const address in tokens){
        let token = tokens[address];
        let div = document.createElement("div");
        div.className = "token_row";
        let html = `
        <img class="token_list_img" src="${token.logoURI}">
        <span class="token_list_text">${token.symbol}</span>
        `
        div.innerHTML = html;
        parent.appendChild(div);
    }
}

async function login() {
  let user = Moralis.User.current();
  if (!user) {
   try {
      user = await Moralis.authenticate({ signingMessage: "Hello World!" })
      console.log(user)
      console.log(user.get('ethAddress'))
   } catch(error) {
     console.log(error)
   }
  }
}

function openModal(){
    document.getElementById("token_modal").style.display = "block";
}

function closeModal(){
    document.getElementById("token_modal").style.display = "none";
}
document.getElementById("modal_close").onclick = closeModal;
document.getElementById("from_token_select").onclick = openModal;
document.getElementById("login_button").onclick = login;

/*async function logOut() {
  await Moralis.User.logOut();
  console.log("logged out");
}*/

init();

Thank you so much!

connect to the moralis server appropriately check this
https://docs.moralis.io/moralis-server/getting-started/connect-the-sdk

1 Like

you can try to update your server to latest version, and remove and reinstall the plugins or update the plugins

2 Likes

Hey @cryptokid, I’m having this error here today after the update

did you try to reinstall the plugin?

I’m using the plugin built-in (sync).

what is the exact error/problem that you have?

Several problems tbh, one of them yesterday was the getPluginSpecs and now I’m having a headache trying to sync the events. Already created more than 50 servers from yesterday to now to make it works. btw yesterday it was working fine and all of sudden every server I create is having the same problem. I’m sure the setup on the plugin is correct because as I said I tested it before with a different server.

ItemsOnSale (not working)

ItemsPublished (worked only for one event fired)

ItemsTransfer (not working)

you should create a new thread for this problem, this is not related to the original thread

I see this in logs: Error syncing syncItemsOnSale "required param chainId not provided" Error: required param chainId not provided , but I don’t know exactly why it would give this error

Did you consider using a testnet instead of local devchain?

1 Like

I think I’m going to do it man because I’m really tired of creating new servers every time.