解析服务器无法识别APP_ID

时间:2019-03-20 11:32:06

标签: node.js heroku parse-platform parse-server

我已经在Heroku上安装了Parse Server,并分叉了Parse Server Example。当我git push heroku master出现错误

  

“您必须提供一个appIp!”

错误日志:

019-03-20T11:03:56.517489+00:00 heroku[web.1]: Starting process with command `npm start`
2019-03-20T11:03:59.418738+00:00 app[web.1]: 
2019-03-20T11:03:59.418754+00:00 app[web.1]: > parse-server-example@1.4.0 start /app
2019-03-20T11:03:59.418756+00:00 app[web.1]: > node index.js
2019-03-20T11:03:59.418757+00:00 app[web.1]: 
2019-03-20T11:04:01.887096+00:00 heroku[web.1]: State changed from starting to crashed
2019-03-20T11:04:01.724008+00:00 app[web.1]: 
2019-03-20T11:04:01.724030+00:00 app[web.1]: /app/node_modules/parse-server/lib/ParseServer.js:218
2019-03-20T11:04:01.724032+00:00 app[web.1]: throw err;
2019-03-20T11:04:01.724033+00:00 app[web.1]: ^
2019-03-20T11:04:01.724105+00:00 app[web.1]: You must provide an appId!
2019-03-20T11:04:01.779713+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-03-20T11:04:01.780520+00:00 app[web.1]: npm ERR! errno 7
2019-03-20T11:04:01.782955+00:00 app[web.1]: npm ERR! parse-server-example@1.4.0 start: `node index.js`
2019-03-20T11:04:01.783173+00:00 app[web.1]: npm ERR! Exit status 7
2019-03-20T11:04:01.783716+00:00 app[web.1]: npm ERR!
2019-03-20T11:04:01.783983+00:00 app[web.1]: npm ERR! Failed at the parse-server-example@1.4.0 start script.
2019-03-20T11:04:01.784194+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-03-20T11:04:01.804701+00:00 app[web.1]: 
2019-03-20T11:04:01.805007+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-03-20T11:04:01.805196+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2019-03-20T11_04_01_786Z-debug.log
2019-03-20T11:04:01.866235+00:00 heroku[web.1]: Process exited with status 7

index.js

    var express = require('express');
    var ParseServer = require('parse-server').ParseServer;
    var path = require('path');

    var databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI;

    if (!databaseUri) {
      console.log('DATABASE_URI not specified, falling back to localhost.');
    }

var api = new ParseServer({
      databaseURI: databaseUri || 'mongodb://key
      cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
      appId: process.env.APP_ID || 'myAppId',
      masterKey: process.env.MASTER_KEY || 'myMasterKey', 
      serverURL: process.env.SERVER_URL || 'http://myApp.herokuapp.com/parse',
      liveQuery: {
        classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions
      }

    });

     var server = ParseServer({
      verifyUserEmails: true,
    publicServerURL: 'myApp.herokuapp.com/parse',
    appName: 'myAppName',
    emailAdapter: { 
        module: 'parse-server-simple-mailgun-adapter',
        options: { 
                   fromAddress: 'parse@example.com',
                   domain: 'domainFromMailGun.mailgun.org', 
                   apiKey: 'myAPIKey', 
                 }
     }
     });   

我在appId中提供了appId: process.env.APP_ID || 'myAppId',,还是我在这里遗漏了什么? appId是否必须在其他地方提供?

1 个答案:

答案 0 :(得分:1)

首先,请 立即 使那些MongoDB凭据无效。它们永远受到损害,您需要生成新的。 不够


我尚不清楚您要在这里做什么,但实际上您是在实例化两个解析服务器。您确实为第一个(SELECT * FROM tablename WHERE date between '$date1' and '$date2' order by date )提供了appId,但没有为第二个(api)提供。

您可能只需要一台Parse Server。如果确实由于某些原因确实需要两个,则每个人都需要一个server