[SOLVED] Moralis Parsed Server Error

When I run the server app, it gives me the following error:

morais@morais-MS-7C75:~/Desktop/market/server$ yarn dev
yarn run v1.22.19
$ ts-node src/index.ts
warn: DeprecationWarning: The Parse Server option 'directAccess' default will change to 'true' in a future version. Additionally, the environment variable 'PARSE_SERVER_ENABLE_EXPERIMENTAL_DIRECT_ACCESS' will be deprecated and renamed to 'PARSE_SERVER_DIRECT_ACCESS' in a future version; it is currently possible to use either one.
warn: DeprecationWarning: The Parse Server option 'enforcePrivateUsers' default will change to 'true' in a future version.
warn: DeprecationWarning: The Parse Server option 'allowClientClassCreation' default will change to 'false' in a future version.
info: Parse LiveQuery Server started running
/home/morais/Desktop/market/server/node_modules/parse-server/lib/ParseServer.js:261
          throw err;
          ^

TypeError: Cannot read properties of undefined (reading 'body')
    at NgrokClient.request (/home/morais/Desktop/market/server/node_modules/ngrok/src/client.js:40:26)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async connectRetry (/home/morais/Desktop/market/server/node_modules/ngrok/index.js:29:22)
    at async Server.<anonymous> (/home/morais/Desktop/market/server/src/index.ts:35:17)

Node.js v18.12.1
error Command failed with exit code 7.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

this is my code:

import Moralis from 'moralis';
import express from 'express';
import cors from 'cors';
import config from './config';
import { parseServer } from './parseServer';
// @ts-ignore
import ParseServer from 'parse-server';
import http from 'http';
import ngrok from 'ngrok';
import { streamsSync } from '@moralisweb3/parse-server';

export const app = express();

Moralis.start({
  apiKey: config.MORALIS_API_KEY,
});

app.use(express.urlencoded({ extended: true }));
app.use(express.json({limit: '50mb'}));

app.use(cors());

app.use(
  streamsSync(parseServer, {
    apiKey: config.MORALIS_API_KEY,
    webhookUrl: '/streams',
  }),
);

app.use(`/server`, parseServer.app);

const httpServer = http.createServer(app);
httpServer.listen(config.PORT, async () => {
  if (config.USE_STREAMS) {
    const url = await ngrok.connect(config.PORT);
    // eslint-disable-next-line no-console
    console.log(
      `Moralis Server is running on port ${config.PORT} and stream webhook url ${url}${config.STREAMS_WEBHOOK_URL}`,
    );
  } else {
    // eslint-disable-next-line no-console
    console.log(`Moralis Server is running on port ${config.PORT}.`);
  }
});
// This will enable the Live Query real-time server
ParseServer.createLiveQueryServer(httpServer);

What could be doing this. From my debug, I think that might be ngrok.connect() failing, but I tried to download the parse server from Moralis github and it gave me the same error in 2 different computers. HELP!

@cryptokid I have watched a lot of your comments on this forum and you already helped me alot. Ty btw

2 Likes

Hey @demorales,

I assume you already fixed this issue, but feel free to let us know in this thread if you face any other issue.

Hello @demorales , Iā€™m getting the same error on railway, how did you solve it?

Thank you

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.