Self-hosting your Moralis server

What doesn’t work? What do you do? What happens?

Was getting ‘Error: File upload by public is disabled’ without changing anything in code.
Then tried signing up in code with dummy user name password but nothing happens. While logging the IPFS URL it just gives ‘undefined’

You can use web3api with uploadFolder in a cloud function

oh ok, its on the client side and even if I have to upload a single file?

You can use that uploadFolder function even for a file. It is not client side, you have to integrate it in a cloud function first in order to be able to call it from the client side.

oh ok will try that - thank you

I think that the clientId is specific to web3auth and the rpcTarget is a RPC url (a node url)

We are Self-Hosting the server, and we are getting the error :-

{"code":101,"error":"Moralis auth failed, invalid data"}

so we are now changing the authentication code

const provider= {
        signingMessage,
        throwOnError: true,
        provider: 'web3Auth',
        chainId: process.env.REACT_APP_WALLET_CONNECT_ID,
        // rpcTarget: process.env.NEXT_PUBLIC_RPCNODE!,
        // clientId: process.env.NEXT_PUBLIC_WEB3AUTH_ID!,
        appLogo: Image,
        theme: 'light',
        loginMethodsOrder: [
          'google',
          'facebook',
          'twitter',
          'discord',
          'reddit',
          'apple',
          'line',
          'github',
          'kakao',
          'linkedin',
          'weibo',
          'wechat',
          'email_passwordless',
        ],
      }
const user = await authenticate(providerDetails)

i am not able to get the user…can you help me with that?
@cryptokid

how did you get the signing message?

how does that signing message looks like?

its a simple string that i have in my .env…i have the process.env covered in the signingMessage

you need a message in a specific format for auth API, a message that you get by requesting a message from auth API

what is that format?..can i replicate it in my env?

I don’t think that you can replicate it in a constant string

here is an example that uses that message

so we need to make a cloud funciton?

that cloud function should already be present on your self hosted server if you are using a parse server

  const getMessage = async () => {
    const a = await Moralis.start({
      serverUrl: process.env.REACT_APP_MORALIS_SERVER_URL,
      appId: process.env.REACT_APP_MORALIS_APP_ID,
    })
    console.log('a', a)
    const b = await Moralis.Cloud.run('requestMessage', {
      address: '<MyADDRESS(Hardcoded)>',
      chain: 1,
      network: 'evm',
    })
    console.log('b', b)
  }

i did this for the message but getting an error

[C0006] Request failed, Bad Request(400): Unauthorized

are you using latest version of moralis v1 sdk? 1.12.0 should be

yea its the same version

did you set the right app id? can you look in network tab to see if the app id is sent on that request to that cloud function?

yea i checked it is hitting to the right APP ID…i have a concern…when i open my self hosted server on http://localhost:1337/server
then also i see the error

{"error":"unauthorized"}