Skip to content

Exception in parse Cloud Code generates internal server error #6953

Closed
@sarsonj

Description

@sarsonj

New Issue Checklist

Issue Description

I have simple cloudCode function:

Parse.Cloud.define("test", async => {
    throw Error("error in function!")
});

What I expect that I get Error (400) response with error JSON. It worked like this before I upgraded from Parse server 4.0.

What I get is Internal server error (500) with HTML output, like:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Error: error in function!<br> &nbsp; &nbsp;at error (/opt/app/node_modules/parse-server/lib/Routers/FunctionsRouter.js:121:16)<br> &nbsp; &nbsp;at processTicksAndRejections (internal/process/task_queues.js:97:5)</pre>
</body>
</html>

Steps to reproduce

Just define cloudCode function and throw Error

Actual Outcome

Internal server error is generated and HTML output is returned

Expected Outcome

JSON response and 400 error is returned

Environment

Server

  • Parse Server version: 4.3.0
  • Operating system: Ubuntu 18.04 LTS
  • Local or remote host: Digital Ocean (but same on local)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions