Self-hosting your Moralis server

I don’t know now, I’m not familiar with netlify

same thing happening on vercel as well. where else can I host my server for free. or any soln for vercel issue?

did you try to run it locally first to see that it runs as expected?

It works flawlessly on local hosts. In fact, I had earlier deployed the same MongoDB URI server to Heroku. As heroku is starting to sift from free to paid services, i planned to shift to Vercel or Netlify. Is it so that, as i have not recreated a cluster, i am getting this problem?
Actually, I am connecting the same MongoDB server uri that worked on heroku to vercel/netlify.
By the way, thank you @cryptokid for your swift and helpful suggestions.

it shouldn’t matter the mongo db url as long as it is external, it should work the same

maybe you have to set the environment variables differently?

changed the app id, and master key

Netlify is for frontend unless you’re using its cloud functions (node.js). I don’t think Parse server would work on Netlify

Not sure where you mean to change the default timeout interval? In the parse server or in the frontend app code?

In cloud code in parse server in the function that gets the message to be signed

Oh right, I see. I changed to 90 but same error. I think its due to my frontend code which comes from an old Moralis eth boilerplate. I’ve tried the demo frontend app and it seems to work (login etc) and I can see the authentication code is different. I’m also logging in via a polygon/matic wallet but doubt that will make a difference. I fiddled around with the frontend code (copied over from the parse frontend demo code related to auth) and it worked (kinda).

But then I get this:

 POST http://localhost:1337/server/functions/getNFTs 403 (Forbidden)

When trying to get NFT data for that logged in User. Also console.log of account is null so something still not quite correct.

I’m getting a MongoTopologyClosedError whenever I try to use the code from the video to migrate from Moralis Hosted MongoDB to self hosted.

The other MongoClient that connects to my self hosted server connects just fine.

How can I connect to the my Moralis MongoDB to get the data off with the ip address and port provided?

MongoTopologyClosedError: Topology is closed
    at processWaitQueue (S:\Dropbox\QuarkStars\mongodb-migration\mongoDBmigartion\node_modules\mongodb\lib\sdam\topology.js:537:46)
    at Topology.selectServer (S:\Dropbox\QuarkStars\mongodb-migration\mongoDBmigartion\node_modules\mongodb\lib\sdam\topology.js:298:9)
    at S:\Dropbox\QuarkStars\mongodb-migration\mongoDBmigartion\node_modules\mongodb\lib\operations\execute_operation.js:32:29
    at maybePromise (S:\Dropbox\QuarkStars\mongodb-migration\mongoDBmigartion\node_modules\mongodb\lib\utils.js:357:5)     
    at executeOperation (S:\Dropbox\QuarkStars\mongodb-migration\mongoDBmigartion\node_modules\mongodb\lib\operations\execute_operation.js:16:37)
    at FindCursor._initialize (S:\Dropbox\QuarkStars\mongodb-migration\mongoDBmigartion\node_modules\mongodb\lib\cursor\find_cursor.js:54:50)
    at FindCursor.[kInit] (S:\Dropbox\QuarkStars\mongodb-migration\mongoDBmigartion\node_modules\mongodb\lib\cursor\abstract_cursor.js:428:14)
    at next (S:\Dropbox\QuarkStars\mongodb-migration\mongoDBmigartion\node_modules\mongodb\lib\cursor\abstract_cursor.js:499:22)
    at fetchDocs (S:\Dropbox\QuarkStars\mongodb-migration\mongoDBmigartion\node_modules\mongodb\lib\cursor\abstract_cursor.js:256:17)
  [Symbol(errorLabels)]: Set(0) {}
PS S:\Dropbox\QuarkStars\mongodb-migration\mongoDBmigartion> node index
MongoServerSelectionError: connection <monitor> to closed
    at Timeout._onTimeout (S:\Dropbox\QuarkStars\mongodb-migration\mongoDBmigartion\node_modules\mongodb\lib\sdam\topology.js:293:38)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7) {
  reason: TopologyDescription {
    type: 'Unknown',
    servers: Map(1) { '' => [ServerDescription] },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: null,
    maxElectionId: null,
    maxSetVersion: null,
    commonWireVersion: 0,
    logicalSessionTimeoutMinutes: null
  code: undefined,
  [Symbol(errorLabels)]: Set(0) {}

But wait would this even migrate users. I assume their data is not so eaily accessible by knowing the ip address.

Which version of moralis-v1 / react-moralis are you using? Make sure you are using the react-moralis versions of enableWeb3() and authenticate() from the useMoralis hook in your new authentication code - not Moralis.enableWeb3() or Moralis.authenticate().

There was a similar issue here which has been fixed in the latest moralis-v1.

If you cannot update to these newer versions e.g. from [email protected] without it breaking that old boilerplate, you can try this workaround here where you update your Parse Server instead.

Make sure you have whitelisted your public IP address in your Moralis server’s settings. You can use tools like MongoDB Compass or mongodump using the IP address and port given in the Moralis dashboard.

With mongodump and mongorestore, you can migrate all data including user data.

Netlify or Vercel aren’t really suitable for normal Node.js backend/server deployments. For a free option you can look at a provider like Render.

I see that they updated the documentation to show how to deploy in aws:

This documentation is incomplete, could someone tell me what are the steps to follow to implement the server in aws?

Can you outline how it is incomplete please?

In the last section it shows how to create a service, it still remains to show how to add the server code

Hey glad. Thanks for the response. I’ll check it out over the weekend.