parse-server: Return new Error from cloud function should respond with error
Before opening the issue please ensure that you have:
- Read the migration guide to parse-server 3.0.0
- Read the migration guide to Parse SDK JS 2.0.0
Issue Description
Am I doing something wrong. I have:
Parse.Cloud.define('my-function', async request => {
logger.trace('my-function', request);
const { user } = request;
if (!user) {
return new Error('Need user');
}
try {
const isValid = await validate(request.user);
if (!isValid) {
return new Error('Invalid user');
}
return {
hello: 'world'
};
} catch (err) {
logger.error('Error in my-function', err);
return new Error('Unexpected server error');
}
});
Should Parse Server respond with an error when I return new Error('Need user');
?
Steps to reproduce
See above
Expected Results
Expected an error response from Parse.
Actual Outcome
Parse responds with HTTP 200 and
{
"result": {}
}
Environment Setup
-
Server
- parse-server version (Be specific! Don’t say ‘latest’.) : 3.0
- Operating System: Mac OS
- Hardware: Macbook
- Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Local
-
Database
- MongoDB version: 4.0.1
- Storage engine: default
- Hardware: Mac OS
- Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): Local
Logs/Trace
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (10 by maintainers)
My bad, Feel free to open a PR if this behavior is problematic
Sent with GitHawk