Parse migration Error to mLabs and Heroku

寵の児 提交于 2019-12-12 17:46:06

问题


I migrated my parse db to Mlabs at least a year ago. I have been working on the app since and parse dashboard said I had migrated successfully. Mlab and Parse were both receiving updates to their databases.

However in the last week or two the app no longer goes past the login page. No code has beed adjusted its a server problem. Here is the error that prints in Xcode logs:

UserInfo={code=100, originalError=Error Domain=NSURLErrorDomain Code=-1011 "(null)", temporary=0, error=The operation couldn’t be completed. (NSURLErrorDomain error -1011.), NSLocalizedDescription=The operation couldn’t be completed. (NSURLErrorDomain error -1011.)

Now I figured maybe I missed a step in the migration process which is very plausible as I am a novice coder. So I followed this tutorial to Migrate Your Parse App To Parse Server With Heroku And mLab. I have followed each step and had success up until the last step: heroku open. It should open a web page that says I dream of being a web site but the page that opens is this:

heroku open error

When I check heroku logs it says:

2017-02-20T19:01:27.142050+00:00 app[web.1]: > parse-server-example@1.4.0 start /app
2017-02-20T19:01:27.142052+00:00 app[web.1]: 
2017-02-20T19:01:27.142051+00:00 app[web.1]: > node index.js
2017-02-20T19:01:28.597494+00:00 app[web.1]: 
2017-02-20T19:01:28.597507+00:00 app[web.1]: /app/node_modules/parse-server/lib/requiredParameter.js:8
2017-02-20T19:01:28.597508+00:00 app[web.1]:   throw errorMessage;
2017-02-20T19:01:28.597509+00:00 app[web.1]:   ^
2017-02-20T19:01:28.597515+00:00 app[web.1]: You must provide a serverURL!

***Edit it was the serverURL was not updated in my index.js Now Heroku loads 'I dream of being a website'.

|improve this question

回答1:


As the logs show your serverURL is missing. In your index.js you can add it to your constructor then redeploy on heroku:

var api = new ParseServer({
   databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
   cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
   appId: process.env.APP_ID || 'xxxxxx',
   masterKey: process.env.MASTER_KEY || 'zzzzz',
   restAPIKey: 'yyyyyy',
   serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse',
});



回答2:


2017-02-20T19:01:28.597507+00:00 app[web.1]: /app/node_modules/parse-server/lib/requiredParameter.js:8
2017-02-20T19:01:28.597508+00:00 app[web.1]:   throw errorMessage;
2017-02-20T19:01:28.597509+00:00 app[web.1]:   ^
2017-02-20T19:01:28.597515+00:00 app[web.1]: You must provide a serverURL!

These lines seem to suggest you have forgotten to include a serverURL in your app main file. If I recall correctly, there might have been additional required parameters that were added through updates. Not sure if serverURL is one of these, but it seems like it would have been in from the start.

Anyway, if you put a serverURL when you create the Parse Server app, this shouldn't happen. If it does, there must be an error in the file beforehand



来源:https://stackoverflow.com/questions/42353018/parse-migration-error-to-mlabs-and-heroku

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!