[SOLVED] Application with self hosted server

Strange, can you define two variables named serverUrl and appId and then use Moralis.start(serverUrl, appId)
?

serverUrl = ‘http://localhost:1337/server’;
appId = 154;
await Moralis.start(serverUrl, appId);

same error

calling from button

{!isAuthenticated && (
<Button
color=“primary-alta”
className=“connectBtn”
size=“small”
onClick={
() => handleAuth(‘metamask’)
//authent()
// authenticate({ signingMessage: ‘Ecommerce App’ })
}
// disabled={isAuthenticating}
>
{user ? user.get(‘ethAddress’) : ’ Wallet Connect’}

)}

What is the error now?

same error
serverUrl is not defined

Try this syntax:

const serverUrl = “https://xxxxx/server”;

const appId = “YOUR_APP_ID”;

Moralis.start({ serverUrl, appId });

const serverUrl = ‘http://locahost:1337/server’;

  const appId = 154;

  Moralis.start({ serverUrl, appId });

Is this server running or accessible?

You can also try 127.0.0.1 instead of localhost

Try with chain id as 1 or 0x1

Error: Connecting to chain failed, as no connected chain was found

const chainId = 1;

  const { message } = await Moralis.Cloud.run('requestMessage', {
    address: account,
    // chain: 1,
    chain: parseInt(chainId, 16),
    networkType: 'evm',
  });

is this right?

Error: Connecting to chain failed, as no connected chain was found

showing chained log as 0x1691

You used 1 here and you got that error?

That error is new to me. I didn’t see it before.

Maybe the error is related to current connected wallet?

It should sign that message after it gets the message from the cloud function.

it signed in now. Thanks
but the database does show user

What does it happen if it doesn’t show a user in the database?

Any error?

Database shows signed address… Thank you.

Just one more query…

the parse server shows domain as defi.account… is it changeable? if I have to change it … what domain should I change.

should the chainId should be 1?

You can change that domain to what you want. You can keep that chain id as 1 there. It works the same if is 1 or something else.

ok. I will leave it as 1. Does this version moralis-v1 be there till March 2023 end or any chance that it will be deprecated?

That version 1 will stay there, it is not developed with new features now, only fixes from time to time.

Thank you so much for your patience and help, appreciate your help.

1 Like