Parse-server POST instead of GET and no public access, migration config

Hi, I still get issues on parse-server migration

Now the problem is, no GET requests allowed for cloud functions, which requests data from classes that have public access, (besides I haven’t even touched to the database that I copied to mongodb.com which works at production right now)

How can I build the exact same setup like I have been using in moralis dashboard? App is ready to work well, but the new parse-server config is kind of primitive to run our app.

How can I set a new config for my parse-server?

I need to be able to send GET requests to be able to list the items for example. Even though I am refactoring, our app has multiple features that difficult to follow the errors where their exact sources.

I’m studying more about web2 and parse-server now but, could you help for this quicker way or guide me to a useful doc, would be appreciated

Hi @atlasdev

Can you share how you found the cloud functions are using post request and not get request is allowed?
I thinks all cloud functions can be called through get request only.

hi @johnversus,

Here is the 2 screenshot together shows the only POST method gets accepted through parse-server.

__


__

Here’s my express engine (index.ts):

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());

app.use(cors());

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

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

app.use('/server/functions/:functionName', (req, res, next) => {
  req.headers['x-parse-application-id'] = config.APPLICATION_ID;
  next();
});

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);


__

And here’s the cloud code snippet./build/cloud/main.js

//...

Parse.Cloud.define('howManyItems', async () => {
    const query = new Parse.Query('ShowcaseItems');
    query.notEqualTo('published', false);
    const itemsLength = await query.count();
    return itemsLength;
});

//...

_

Even for that little snippet requires authentication at my migration app, which no needed in moralis servers.

that parse-server configuration from moralis’ free-prototype-app-servers would fix all totally I believe cos’ our app is seamlessly working there at the moment.

Thanks for your interest, I hope that won’t erodes tolarance much.

update:

I leared that parse-server doesn’t allow GET requests as default, which is alright, I can refactor the app to this fact. But now the application gets ws connection error for that line in index.ts: ParseServer.createLiveQueryServer(httpServer);

Btw, I noticed the new versions of

they are coming as 2.14.3 in parse-migration package from github. Should I update them to latest?

Hi @atlasdev

sry I am not aware of this from parse server. I might have to dig more onto this.

If you have found a solution by upgrading then you can test it once by upgrading.

hi @johnversus thanks for your interest, I think this is only parse-server issue so moralis doesn’t want to be part of it, I see, I’m doing my research as far as I can go with it.

I did the test, updating moralis from 2.14.3 to up makes the migration app explode, couldn’t build from TS. it can’t deal with the new versions. I rolled back package.json to origins of the github folder.

I’ll try to deploy to heroku and try out in there only to understand if it’s all HTTPS issue or not.

wish me luck!

1 Like