parse-server: When a cloud function has no result the response is malformed
Issue Description
Cloud functions return a json response formatted as {result: ... }
which is then interpreted by the client SDKs
But when it should return a undefined
result, instead of returning {result: undefined}
, it returns {}
which is really not a valid json object, and which causes an error in the JS SDK for example.
To ensure the JSON response can be stringify we could use a replacer method to replace all the undefined by null values…? Or we need to ensure all SDKs can cope with this kind of invalid json result…
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 27 (21 by maintainers)
@joshkopecek it’s not a query, it’s a cloud function. So you could have a cloud function to retrieve a value if exists and nothing if not (i.e. undefined) So as @flovilmart said, the best way to do it is to force a null return value