在heroku服务器上的幽灵博客的密码authentication失败

我正在尝试设置Ghost(node.js博客应用程序)在Heroku服务器上运行。 我在这里按照这个教程,但是当我加载应用程序的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 varibles设置正确,即没有错别字,没有额外的空格在string的开始处添加。

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

这个问题似乎比较常见,但我已经尝试了其他post的大部分解决scheme,似乎没有什么解决问题的。

我试过的解决scheme:

  • 检查了所有错别字的错别字
  • 检查了正确的数据库升级
  • 手动添加用户凭证到远程数据库(出于某种原因,我仍然可以通过命令行访问远程数据库)
  • 运行以下命令heroku config:set PGSSLMODE=require
  • 确保我在通过浏览器连接到网站时在url中使用https
  • 我已经将以下内容添加到我的config.js ssl: true的生产环境中的db params
  • 我也检查了我在生产环境中

build议我没有尝试过:

  • 有人build议节点需要更新。 但是我看不出任何更新heroku使用的节点版本的方法。
  • Somonebuild议postgres需要更新。 但是我看不到在heroku服务器上更新的方法。 但是,我将package.json文件中的版本号从4.1.1更新到了4.5.5,并将其从optionalDependencies移动到了dependencies。
  • 编辑pg_hba.conf – 再一次,我想这个文件存在于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: ├── ...