Self-hosting your Moralis server

Yeah I added my cloud function because that’s all I needed then I deployed to herokuapp and it said that I need to pay because I’m using redis so I did I only paid $7 to test I was planning to upgrade if it worked then after that, the redis error went away and I added my environment variable and started all dynos again but still nothing like I have done everything possible it’s still not working, my only option I can add you as a collaborator so u can help me check

Let me dm you on discord bro

OMG me too mate. I feel like I’ve spent ages building in a framework that just cut away half my functional code cos I opted to use my secure cloud functions.

I can’t get Moralis.Object and Moralis.File to work, maybe need to replace with native MongoDb and AWS S3 libraries.

How did you manage to add your cloud functions to main.ts in /cloud/ on parse server? Any tips would be very much appreciated. Thanks

you should be able to add cloud functions directly in a file that is specific to cloud functions, the file path is specified in parse server config, I think that it is called cloud.js

I tried adding my cloud functions which is all one file as a .js (no typescript) to the /cloud folder but it doesn’t do anything when I run yarn cloud:gen or whatever it was.

It seems like the documentation is kinda limited for helping with the cloud functions migration in the self hosted setup? Seems like a lot of your community could do with more docs/help.

Thanks for replying tho Cryptokid. Any help appreciated

You have to add them in a specific file, not only in a folder. It should be easy to add them there after you understand where you have to add them.

Other than that you should use Parse.Cloud instead of Moralis.Cloud

Ok cool. I’ll take another look to see if I can work it out.

Does the Parse server backwardly support the Moralis.Object and Moralis.File commands in cloud functions?

It should work with Parse.Object and Parse.File

It does look like you need to convert all cloud functions to Typescript and add it some eslint ignores to get anywhere

You can only “build” from the file that you point to in the config. Which is set to /cloud/main.ts by default

you could change that file from config (in parse server config) to a separate one too, you could try to use /cloud/main.js

I think I got it working locally but now I get errors when trying to auth (which was working previously on Moralis cloud rather than the local Parse server).

Inspector console error: http://localhost:1337/server/users 404 (Not Found)

Parse server output:

warn: DeprecationWarning: auth.moralisEth is deprecated and will be removed in a future version. auth.moralisEth.enabled: true
error: Moralis auth failed, invalid data {"code":101,"stack":"Error: Moralis auth failed, invalid data\n    at /Users/me/Documents/projects/parse-server/src/auth/MoralisEthAdapter.ts:32:13\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Promise.all (index 0)"}
info: Ran cloud function getPluginSpecs for user undefined with:
  Input: {}
  Result: [] {"functionName":"getPluginSpecs","params":{}}
info: Ran cloud function getServerTime for user undefined with:
  Input: {}
  Result: null {"functionName":"getServerTime","params":{}}
warn: DeprecationWarning: auth.moralisEth is deprecated and will be removed in a future version. auth.moralisEth.enabled: true
error: Moralis auth failed, invalid data {"code":101,"stack":"Error: Moralis auth failed, invalid data\n    at /Users/me/Documents/projects/parse-server/src/auth/MoralisEthAdapter.ts:32:13\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Promise.all (index 0)"}

you can try to change the default timeout interval that is 15 seconds for the message that is generated

do you get to sign the expected message? it is a long message?

Hi
Instead of heroku can i deploy the server to Vercel or Netlify?
I tried deploying it to netlify but it did not work.
Can someone tell me how to deploy server to production on vercel / netlify.
@cryptokid @alex

you can deploy it anywhere you want, it should be similar instructions

but you will need a place where you can deploy a custom backend

i did exactly similar stuff as in the tutorial
then chose build commands as yarn build && yarn dev

Just the logs show that could not connect to server url and hence you can not use cloud functions etc

can you paste the error from logs?

WARNING, Unable to connect to ‘https://iridescent-tulumba-10e434.netlify.app/’. Cloud code and push notifications may be unavailable!

before this i also included /server at the end of url but it still didn’t work

you could try to change the port from 1337 to 80 or 443

this seems to try to do something https://iridescent-tulumba-10e434.netlify.app:1337/ but it is not able to respond

Both PORT 80 and 443 ain’t seem to work.


@cryptokid any other solution? Thankyou