Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 分析服务器无法识别应用程序\u ID_Node.js_Heroku_Parse Platform_Parse Server - Fatal编程技术网

Node.js 分析服务器无法识别应用程序\u ID

Node.js 分析服务器无法识别应用程序\u ID,node.js,heroku,parse-platform,parse-server,Node.js,Heroku,Parse Platform,Parse Server,我已经在Heroku上安装了Parse Server,并将。当我git推heroku master时,我得到了错误 “您必须提供应用程序IP!” 错误日志: 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

我已经在Heroku上安装了Parse Server,并将。当我
git推heroku master
时,我得到了错误

“您必须提供应用程序IP!”

错误日志:

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:process.env.APP|u ID | |“myAppId”中提供了
appId
,或者我在这里遗漏了什么?是否必须在其他地方提供appId?

首先,请立即使那些MongoDB凭据无效。他们永远是妥协的,你需要创造新的。从你的问题中编辑它们是不够的


我不完全清楚您在这里要做什么,但实际上您正在实例化两个解析服务器。您确实为第一个(
api
)提供了
appId,但没有为第二个(
server
)提供


您可能只需要一个解析服务器。如果出于某种原因确实需要两个,那么每个都需要一个
appId

您刚刚泄漏了MongoDB连接字符串。如果这些是你的真实凭证,你应该立即将其作废。他们永远是妥协的,你需要创造新的。因为您已经从环境中加载了它,所以没有必要将其包含在代码中(事实上,您可能不应该这样做)。谢谢您让我知道。。那个问题完全失败了。很抱歉我是个木偶!我已将问题编辑为包含实际问题。@Neccer,你的新问题与旧问题完全不同。这应该是一个新问题,而不是对这个问题的编辑。我将把你的问题退回到以前的状态。如果我的回答回答了你原来的问题,请考虑。