解析服务器无法识别 APP_ID

Posted

技术标签:

【中文标题】解析服务器无法识别 APP_ID【英文标题】:Parse Server not recognizing APP_ID 【发布时间】:2019-03-20 11:32:06 【问题描述】:

我已经在 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: process.env.APP_ID || 'myAppId', 中提供了appId,还是我在这里遗漏了什么? appId 是否必须在其他地方提供?

【问题讨论】:

您刚刚泄露了您的 MongoDB 连接字符串。如果这些是您的真实凭据,您应该立即使它们失效。它们永远受到损害,您需要生成新的。无需将其包含在您的代码中(实际上您可能不应该),因为您已经从环境中加载了它。 【参考方案1】:

首先,请立即使这些 MongoDB 凭据无效。它们永远受到损害,您需要生成新的。从您的问题中编辑它们是不够


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

您可能只需要一个 Parse Server。如果您出于某种原因确实需要两个,则每个都需要一个 appId

【讨论】:

感谢您让我知道.. 这个问题完全失败了。对不起,我是个布偶!我已编辑问题以包含实际问题。 @Neccer,您的新问题与您的旧问题完全不同。这应该是一个新问题,而不是对此问题的编辑。我要把你的问题回滚到以前的状态。如果我的回答回答了您最初的问题,请考虑voting it up (or down) or accepting it。

以上是关于解析服务器无法识别 APP_ID的主要内容,如果未能解决你的问题,请参考以下文章

命令行解析器动词无法识别

Oracle几个基础配置问题:ORA-12154: TNS: 无法解析指定的连接标识符ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务ORA-12516 TNS监听程序找(代

BigQuery 在解析时无法识别时区

解析 Facebook 登录未执行,PFDateFormatter 无法识别选择器

ESLint 无法识别根别名 (@)

Oracle几个基础配置问题:ORA-12154: TNS: 无法解析指定的连接标识符ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务ORA-12516 TNS监听程序找(代