解析服务器无法识别APP_ID

问题描述 投票:0回答:1

我在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]: > [email protected] 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! [email protected] 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 [email protected] 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: '[email protected]',
                   domain: 'domainFromMailGun.mailgun.org', 
                   apiKey: 'myAPIKey', 
                 }
     }
     });   

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

node.js heroku parse-platform parse-server
1个回答
1
投票

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


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

您可能只需要一个Parse Server。如果你确实需要两个由于某种原因,每个人将需要一个appId

© www.soinside.com 2019 - 2024. All rights reserved.