heroku 服务器上的幽灵博客密码验证失败

Password authentication failing for ghost blog on heroku server

我正在尝试在 heroku 服务器上将 Ghost(node.js 博客应用程序)设置为 运行。我已按照此处的 this 教程进行操作,但在加载应用 URL 时出现应用程序错误。查看日志,我得到以下堆栈跟踪:

2016-12-16T10:00:08.185701+00:00 heroku[web.1]: Starting process with command `NODE_ENV=production node index.js`
2016-12-16T10:00:11.989635+00:00 app[web.1]: 
2016-12-16T10:00:11.989655+00:00 app[web.1]: ERROR: password authentication failed for user "xxxxxxxxxxxxxx" 
2016-12-16T10:00:11.989656+00:00 app[web.1]:  error: password authentication failed for user "xxxxxxxxxxxxxx"
2016-12-16T10:00:11.989656+00:00 app[web.1]:  
2016-12-16T10:00:11.989658+00:00 app[web.1]:     at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:361:17)
2016-12-16T10:00:11.989657+00:00 app[web.1]:     at Connection.parseE (/app/node_modules/pg/lib/connection.js:534:11)
2016-12-16T10:00:11.989659+00:00 app[web.1]:     at TLSSocket.<anonymous> (/app/node_modules/pg/lib/connection.js:105:22)
2016-12-16T10:00:11.989660+00:00 app[web.1]:     at emitOne (events.js:96:13)
2016-12-16T10:00:11.989661+00:00 app[web.1]:     at readableAddChunk (_stream_readable.js:176:18)
2016-12-16T10:00:11.989662+00:00 app[web.1]:     at TLSSocket.Readable.push (_stream_readable.js:134:10)
2016-12-16T10:00:11.989660+00:00 app[web.1]:     at TLSSocket.emit (events.js:188:7)
2016-12-16T10:00:11.989663+00:00 app[web.1]:     at TLSWrap.onread (net.js:548:20) 
2016-12-16T10:00:11.989664+00:00 app[web.1]: 
2016-12-16T10:00:12.059675+00:00 heroku[web.1]: Process exited with status 0
2016-12-16T10:00:12.098899+00:00 heroku[web.1]: State changed from starting to crashed
2016-12-16T10:00:11.574238+00:00 app[web.1]: WARNING: Ghost is attempting to use a direct method to send email. 
2016-12-16T10:00:11.574254+00:00 app[web.1]: It is recommended that you explicitly configure an email service.
2016-12-16T10:00:11.575112+00:00 app[web.1]: Help and documentation can be found at http://support.ghost.org/mail.
2016-12-16T10:00:11.575114+00:00 app[web.1]: 
2016-12-16T12:20:59.497399+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ai-blog.herokuapp.com request_id=a725a350-ade1-4f00-9b8a-125fac34eb23 fwd="82.46.0.56" dyno= connect= service= status=503 bytes=
2016-12-16T12:21:01.504908+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ai-blog.herokuapp.com request_id=cc0c4f9b-f3af-4867-942f-0c7f295f9b90 fwd="82.46.0.56" dyno= connect= service= status=503 bytes=
2016-12-16T12:21:03.381794+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ai-blog.herokuapp.com request_id=ee190254-0159-4ba0-aa74-6e58f661c966 fwd="82.46.0.56" dyno= connect= service= status=503 bytes=

似乎这里错误的重要部分是密码失败:但我已经双重和三次检查所有 heroku 变量是否设置正确,即没有拼写错误,没有在字符串的开始结束。

此外,该应用 运行 在本地运行良好。

这个问题似乎比较普遍,但我已经尝试了其他帖子中的大部分解决方案,但似乎都无法解决问题。

我尝试过的解决方案:

我没试过的建议:

有人有什么想法吗?

我在尝试升级到 Ghost 版本 0.11.3 并部署到 Heroku 时遇到了同样的问题。

我通过升级 PostgreSQL npm 包解决了这个问题。

package.json中:

{
  "dependencies": {
    "pg": "^4.5.5",
  },
  "optionalDependencies": {
    "pg": "^4.5.5"
  }
}

并且您还需要修改 npm-shrinkwrap.json 文件:

{
  "dependencies": {
    "pg": {
      "version": "^4.5.5",
      "from": "pg@4.5.5",
      "resolved": "https://registry.npmjs.org/pg/-/pg-4.5.5.tgz",
      "dependencies": {...}
    }
  }
}

之后,通过查看 Heroku 的部署日志来检查 PG npm 包版本是否已正确更新。它应该是这样的:

remote: -----> Build succeeded!
remote:        ├── ...
remote:        ├── pg@4.5.5
remote:        ├── ...