Skip to content

Cloud Job unexpected error kills server #3270

Closed

Description

@lizcodezpink

While testing and updating some functionality in a Cloud JOB for our migration I mistyped and created an error:
TypeError: Cannot read property 'createToken' of undefined

Very simple. I need to fix my typo.

The REAL issue is that the parse-server's node process DIED.

I moved the same code to a Cloud Function and simply received a 500 internal server error. (Expected for the typo and reasonable. The server lives and continues serving requests.) I would expect the same behavior for a Job.

Steps to reproduce

Please include a detailed list of steps that reproduce the issue. Include curl commands when applicable.

Place this code in your main.js cloud code file.

Parse.Cloud.job("testBadJob", function(request, response){
    var myObj = undefined;
    //Attempt to access undefined value
    var abc = myObj.shouldHaveValue;
    response.success();
});

Parse.Cloud.define("testBadFunction", function(request, response){
    var myObj = undefined;
    //Attempt to access undefined value
    var abc = myObj.shouldHaveValue;
    response.success();
});

Expected Results

The Job should fail and the server should not exit. A 500 or any other error response would be sufficient.

The Cloud function should fail and not kill the server.

Actual Outcome

The Job fails and kills the server process.

The Cloud function fails and does NOT kill the server.

Environment Setup

  • Server

    • parse-server version: 2.3.1
    • Operating System: AWS Linux and Win 10
    • Hardware: standard
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Both
      AWS - 64bit Amazon Linux 2016.09 v3.2.0 running Node.js
      Localhost - Windows 10; node 6.9.1;
  • Database

    • MongoDB version: 3.2.11
    • Storage engine: MMAPv1
    • Hardware: not sandbox
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): mLab

Logs/Trace

/var/app/current/node_modules/parse-server/lib/ParseServer.js:437
throw err;
^

TypeError: Cannot read property 'shouldHaveValue' of undefined
at /var/app/current/cloud/main.js:1198:20
at /var/app/current/node_modules/parse-server/lib/Routers/FunctionsRouter.js:106:11
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)

Activity

  1. emkman commented on Jan 24, 2017

    @emkman

    @ascholz81 In case this is still an issue for you, Cloud Jobs aren't supported in parse-server. See https://github.com/ParsePlatform/parse-server/wiki/Compatibility-with-Hosted-Parse#jobs

  2. lizcodezpink commented on Jan 24, 2017

    @lizcodezpink
    Author

    I understand Jobs themselves aren't scheduled, however they can still be ran and used on demand.

    The main issue here is that whether it was a Job or Cloud Function that the Parse Server did not return from that call with any response or error.

  3. dplewis commented on Mar 23, 2018

    @dplewis
    Member

    Closing as addressed #3431

    Please update to the latest version of Parse Server and open an issue if the issue still persists.

  4. lizcodezpink commented on Mar 23, 2018

    @lizcodezpink
    Author

    Fantastic!!! Thanks so much. Had a busy start to my year and didn't realize the previous comment in January. Will check it out next week and implement new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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