[SOLVED] Moralis Server Deprecated for pro plan

Moralis is stating for me to select prevent sleep option for the server but it is grayed out & can’t be selected. It sends me to documentation to create a self hosting server instead. How can I shift my server to self hosting, need complete guidance to shift from server to self hosting server with pro plan. Thankyou.
Screenshot from 2023-10-26 15-05-35

Hi there, we have a guilde here on how to set up a self hosted server

https://v1docs.moralis.io/moralis-dapp/getting-started/self-hosting-moralis-server

Well basically I have seen this but I don’t understand how I will use the pro plan with my self hosted server.

Self host backend uses the Moralis API to get the blockchain data. So when you are using the self hosted server you actually use the pro plan API resources by calling the API endpoints.

Check the pro plan features on the pricing page

After deploying the server, how would I migrate my moralis server data to the self hosted server, as the moralis server option in moralis dashboard has grayed out and its not opening the server. Thankyou

Please send an email to [email protected]. They can assist you with restoring the server for a couple of days so you can take data backup.

1 Like

I was using the moralis server, now I have created my own server but it doesn’t do the job now
I have replaced the server url, app id and master for my new server but it doesn’t work in the application. when I user http is gives me unauthorized error and when I use https it gives me nothing, it doesn’t do the work.

Previous Server:
   const SERVERURL = 'https://xxxxxxxx.usemoralis.com:2053/server';
    const APPID = 'xxxx';
    const MASTERKEY = 'xxxxx';
    await Moralis.start({
      serverUrl: SERVERURL,
      appId: APPID,
      masterKey: MASTERKEY,
    });

For example in the previous moralis server, this sent a post request against the moralis server (https://xxxxxxxx.usemoralis.com:2053/server/functions/getNativeBalance). This was working properly but now with the new self hosted server, this doesn’t work.

 await Moralis.Web3API.account
          .getNativeBalance({
            chain: '0x1',
            address: res.wallet_address,
          })

How can I fix this, my application is in production, need quick fix for all of the server related stuff. Thankyou

What are the errors you are seeing?

Did you setup the server as per the docs? Also, have a look at this video if you are stuck somewhere.

I was using this functionality of moralis to upload my NFTs on the moralis server, and now I have shifted to Moralis self hosted server, but this is not working how can I fix it. How can I upload my NFTs on the moralis self hosted server with the metadata.
Here is the logic of how I was storing it on the Moralis server:

Firstly I stored the NFT image/video/audio on Moralis server this like:

const file = new Moralis.File(this.Title.toString(), {
 base64: this.base64_data,
});
await file.saveIPFS({ useMasterKey: true }).then((res) => {
        let imagesplit = res._url.split('/');
        let splitid = imagesplit[6];
        let imageid = splitid.replace('.txt', '');
        this.server_upload_url =
          'https://gateway.moralisipfs.com/ipfs/' + imageid;
      });

Then I stored the metadata like this in the server, how can I fix this issue with my self hosted server, as the server sends the requests and it never returns the response

    let metadata = {
      name: this.Title,
      description: this.Message,
      image: this.server_upload_url,
      category: this.NFT_Information.catergory,
    };
    let file = new Moralis.File('file.json', {
      base64: btoa(JSON.stringify(metadata)),
    });
    await file.saveIPFS({ useMasterKey: true }).then(() => {
      this.metadata_ID = file['_name'].replace('.txt', '');
      this.metadata_URL = 'https://ipfs.moralis.io:2053/ipfs/' + this.metadata_ID;
    });

Hi @shirazshakeel86

You can replace Moralis.File with Parse.File. Moralis server internally used the same method to upload files to parse server.
Please have a look at the below docs for more details.

To use the IPFS upload you can use IPFS services like piniata ipfs. We were using the same services for IPFS hosting. You might need to create cloud functions to handle these in server.

Can you guide me properly for this matter, as I could get the desired results from the above mentioned statement. Thankyou

I migrated my moralis database to mongodb database without indexing, does that create an issue for moralis to authenticate the user when it can’t find the indexing? thankyou

It should also work without directly making any changes to the database.
Have a look at this video. You can use that he was using it with doing any migrations.

Are you seeing any errors while trying this?

I am seeing “moralis auth failed invalid data” error while authenticating the user.

Is it compulsary to use this:

const { message } = await Moralis.Cloud.run("requestMessage", {
        address: "metamask wallet address",
        chain: parseInt(chainId, 16),
        network: "evm",
      });

and then use this?

await Moralis.authenticate({
        qrModalOptions: {
          themeMode: 'dark',
          explorerRecommendedWalletIds: [
            'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96',
          ],
        },
        provider: 'walletconnect',
        projectId: 'walletconnectprojectid',
        signingMessage: 'Authenticate via my app',
      })

The message received from the requestMessage cloud function should be passed as param value to the authenticate function. It should not be a hardcoded string.

signingMessage: message,

Brother I am asking is this compulsory to use the cloud.run function before authenticating?

const { message } = await Moralis.Cloud.run("requestMessage", {
        address: "metamask wallet address",
        chain: parseInt(chainId, 16),
        network: "evm",
      });

and we have to pass the metamask wallet address in the place of address? and the chainId like “0x1”?

Property ‘message’ does not exist on type ‘void’

it is giving me this error when i pass message to signing message in authenticate function.

This is for solving moralis auth failed invalid data error. So yes you need to call requestMessage cloud function with the required parameters.

In the address parameter, we have to pass the required metamask wallet address? and in the chainid (my work is on mainnet ethereum, should I pass (“0x1”,16) to chainid parameter?