我试图设置Ghost(node.js博客应用)在heroku服务器上运行。我在此处遵循了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变量都设置正确,即没有拼写错误,没有添加额外的空格开始字符串的结尾。
此外,该应用程序在本地运行良好。
这个问题似乎比较常见,但我已尝试过其他帖子的大多数解决方案,似乎没有解决问题。
我尝试过的解决方案:
heroku config:set PGSSLMODE=require
ssl: true
我没有尝试过的假设:
有人有任何想法吗?
答案 0 :(得分:1)
尝试升级到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: ├── ...