Moralis-admin-cli deploy What server do you want to connect to?:Invalid Input

ok, can you try to remove current cloud code and update your server?

I try to update and re start the server and give me this error:

There is a Cloud Function Error (Syntax/Undefined Variables) on your code, in order to Update/Restart your server fix the error first, You can check the full Log on the Dashboard -> Logs -> Error

yes, I was expecting that, that is why I said first to remove current cloud code

What current cloud code
you mean? Do I delete the server and create a new one?

Or do you mean the cloud functions? I have the following;

Moralis.Cloud.define("getAvgGas", async function (request) {
  const query = new Moralis.Query("BscTransactions");
  const pipeline = [
    {
      group: {
        // group by "from_address"
        objectId: "$from_address",
        // add computed property avgGas
        // get average and convert wei to gwei
        avgGas: { $avg: { $divide: ["$gas_price", 1000000000]} },
      },
    },
    { sort: { avgGas: -1 } }, // sort by avgGas high to low
    { limit: 10 }, // only return top 10 results
  ];

  // the master key is required for aggregate queries
  const results = await query.aggregate(pipeline, { useMasterKey: true });
  return results;
})

no, I mean to remove that cloud code (cloud functions) after you make it a backup, in case that it is an error because of that code that it is added there

I’m trying to delete that function in the cloud but it won’t let me. The safeFile button does not update the delete code.

It gives me the impression that the most effective thing is to delete the server and create a new one.

what you mean by this, how it doesn’t let you to save?

exactly. dont let me save when remove the code.

how does it stop you from doing that?

It doesn’t stop me. It doesn’t work directly. It does not update the file.

I’m trying now to update your server

server updated, can you try again now with moralis-admin-cli?

Of course. I go to it and inform you right away.

Keep with the same problem. But I have not deleted the cloud function. I go to it and inform you.

Still no server detects me through the console.
para_mandar

ok, it worked for me, I got this:

Following servers were found:
(0) Testnet
What server do you want to connect to?:

maybe try to reinstall moralis-admin-cli

Let’s try to get this right.

Do I install it globally or locally?

I did it in administrator mode with my Powershell from my windows operating system.

If I install it locally, what is the most correct way to do it? via npm?

you can also install it locally: npm init --yes, npm install --save moralis-admin-cli, but then you will have to run it from that specific folder where that that npm init was executed

We finally got it!

A local installation seems to be adequate.

I want to thank you for your time and patience in helping me.

Thank you.

para_mandar

just one more thing … do you think the cloud function could have caused a problem? Would you put it back?