You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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){varmyObj=undefined;//Attempt to access undefined valuevarabc=myObj.shouldHaveValue;response.success();});Parse.Cloud.define("testBadFunction",function(request,response){varmyObj=undefined;//Attempt to access undefined valuevarabc=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
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)
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.
Activity
emkman commentedon Jan 24, 2017
@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
lizcodezpink commentedon Jan 24, 2017
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.
dplewis commentedon Mar 23, 2018
Closing as addressed #3431
Please update to the latest version of Parse Server and open an issue if the issue still persists.
lizcodezpink commentedon Mar 23, 2018
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.