parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Cloud function is returning array of Pointer objects instead of full objects.

Open rsweny opened this issue 10 years ago • 1 comments

Environment Setup

Heroku + MongoLab

Steps to reproduce

I am returning an array of Parse objects within a larger object and on the Parse.com server this works fine and I get back the array of objects with their fields populated. However on this server (2.1.6) the array is just a series of pointers with no fields.

I can work around it by doing this before my response:

            for (var i = 0; i < bundleArray.length; i++) {
                var questionString = JSON.stringify(bundleArray[i]);
                bundleArray[i] = JSON.parse(questionString);
            }

But this seems very hacky. I suspect the problem can be traced to here: https://github.com/ParsePlatform/parse-server/blob/master/src/Routers/FunctionsRouter.js#L20

and then further back to here:

https://github.com/ParsePlatform/Parse-SDK-JS/blob/master/src/encode.js#L33

Logs/Trace

rsweny avatar Mar 15 '16 19:03 rsweny

Parse Cloud Code and parse-server Cloud Code are two different environments, and there are bound to be some small differences between the two. Your solution seems like a reasonable work around.

I'm closing this as we expect that some developers will need to update their Cloud Code when migrating to parse-server, and we are not considering minor differences between the two environments as actionable issues in parse-server.

hramos avatar Apr 01 '16 23:04 hramos