smoke February 2016

How to move cloud code from parse.com to heroku

I have moved parse sever from parse.com to heroku. Everything is working fine except cloud code('cloud/main.js' file).

I have replaced "main.js" of parse.com with "main.js" of parse server code and deployed on heroku, but it is not working. Getting following error when I make request from my mobile app

{"code":1,"message":"Internal server error."} (Code: 1, Version: x.xx.x)

Any idea?

Note: I've followed following link for migrating parse server

https://learnappmaking.com/how-to-migrate-parse-app-parse-server-heroku-mongolab/

Answers


Parth Tiwari February 2016

Thank you for posting this question, I am getting the same error. I have tried with Amazon and with Heroku both. I first get the error,

[Error]: {"code":1,"message":"Internal server error."} (Code: 1, Version: 1.12.0)

and then

Code=3840 "JSON text did not start with array or object and option to allow fragments not set."

"Internal server error" when migrating Parse to Heroku/AWS

Please let me know if you figured out the reason


zelusp March 2016

Migrating cloud code can range in difficulty depending on how involved that code is. Here's a workflow for validating your code:

1) Check that you can build your Heroku app locally with the right Node version.

2) Comment out all of your cloud code. You want to start introducing your code in parts and make sure it compiles with each re-introduced function.

3) Install the node modules for each service that you use. If you use stripe/mailgun or any other package, add them in your package.json file and run npm install. Then include them in your main.js file with the require('packageName').

4) The cloud server uses Express.js version 4.2 and a Parse.com runs Express version 2.0 or 3.0 but not 4.0. If you use any middlewear then you need to change it to the proper Express 4.0 syntax/methodology.

5) There is no support for cloud jobs so rename all your *.job functions to *.define and comment properly so you can come back to them later. If you did not use cloud jobs then don't worry.

6) If you did use cloud jobs, now you need to setup a heroku worker/scheduler to run those old *.job (now *.define) calls at the proper time intervals you had.

Post Status

Asked in February 2016
Viewed 1,784 times
Voted 10
Answered 2 times

Search




Leave an answer