-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Help Debugging main.js syntax issues after migration #2948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
if your file is now named |
sorry--the issue wasn't that it's named newmain.js--I've just renamed it that way so I could show the file that I want to use. The issue is that if I use that file (newmain.js) as my main.js file, instead of the example main.js that is included in parse-server-example--then core functionality of parse server breaks, like logins suddenly don't work. I did some more testing and tried changing my main.js file to include just one function from my newmain.js file, presumably one that doesnt have any syntax errors, and then my parse implementation worked again and I was able to login and use other functions on the client. Is there any way to debug your main.js file to know if it has syntax errors? Because it seems like if I upload something that has errors, the whole functionality of parse just seems to not work. |
You can try running your main.js through a linter such as eslint to find errors. An IDE like Webstorm can find them too. I recommend you write some unit/integration tests for each endpoint of your main.js - check out package.json and helper.js in parse-server to see how to set up a local server as part of tests. You could also just run your server locally with your bugged main.js and likely you'll see some errors on the console at startup or when sending a request via curl. I don't think it is going to be possible to catch all errors when cloud code is loaded, and the responsibility for this has to lie with the application and not parse-server. Perhaps we could try/catch when mounting cloud code endpoints and display an error. |
That seems dangerous to deploy with caught exceptions as one user may have security logic in it's hooks. Unlike parse.com where cloud code was loaded at each request, we actually need all triggers and functions at startup time (given the current architecture) |
I need help migrating my parse server and was directed here by the parse support page.
I have finished the database migration to an mLab database and have the parse server example running in heroku.
My project runs perfectly at retrieving my current data with the default parse server example main.js file, but I would like to still run ParseServer jobs from the client like in this iOS example so I would like to use my own main.js file.
[PFCloud callFunction:@"publishCard" withParameters:@{
@"cardID" : card.cardPF.objectId,
} error:&error];
When I try to run my project with the following file as main.js (I've renamed it newmainjs just for visibility), it doesn't let me login with parse at all anymore from my iOS Client--so it seems to be triggering errors and I have no idea how to debug it as it's not covered in the migration tutorial.
https://github.com/KetchupMoose/cardgameserver/blob/master/cloud/newmain.js
I am very amateur at backend/node so I would really appreciate some support, as I relied on Parse for a lot of things before.
The text was updated successfully, but these errors were encountered: