Hello,
Iām working on migrating my formerly Moralis hosted server to a self hosted server. To do so, Iām using the āparse-server-migrationā. Most of the migration work has been done but Iām still struggling with some issues with cloud functions.
Long story short, I have a bunch of cloud functions that are working properly on Moralis server that Iām trying to use in my self hosted one. For some reasons Iām getting errors even tho the code is almost exaclty the same. Here is a simple example
Moralis server cloud function
/**
* Return player's available prizes
* @param playerId (objectId)
*/
Moralis.Cloud.define('getLoot', async (request) => {
const playerId = request.params.id;
const Prizes = Moralis.Object.extend('Prizes');
const prizeQ = new Moralis.Query(Prizes);
prizeQ.equalTo('ownerId', playerId);
prizeQ.equalTo('status', 'locked');
const results = await prizeQ.find();
return results;
});
Self hosted cloud function
/**
* Return player's available prizes
* @param playerId (objectId)
*/
Parse.Cloud.define('getLoot', async (request: any) => {
const playerId = request.params.id;
const Prizes = Parse.Object.extend('Prizes');
const prizeQ = new Parse.Query(Prizes);
prizeQ.equalTo('ownerId', playerId);
prizeQ.equalTo('status', 'locked');
const results = await prizeQ.find();
return results;
});
And I get this error :
error: TypeError: Cannot read property āprotectedFieldsā of undefined
Do you see anything wrong here ?