gpt4 book ai didi

heroku - 尝试在 Heroku 上运行迁移时出现 Sequelize 错误

转载 作者:行者123 更新时间:2023-12-03 22:16:56 25 4
gpt4 key购买 nike

所以我三重检查了我的 config.json 以确保所有的键都与 heroku 数据库对齐:

"production": {
"name": "NAME",
"user": "USER",
"port": "5432",
"pass": "PASSWORD",
"host": "HOST",
"dialect": "postgres"
}

我知道这些值有效,因为我可以使用 pgcommander 访问数据库。然后我执行以下步骤:
heroku config:set NODE_ENV='production' --app APP_NAME heroku run node_modules/.bin/sequelize db:migrate
但在迁移失败后总是以以下错误告终:
[00:27:42] Finished 'db:migrate' after 88 ms
Unable to connect to database: Error: SequelizeConnectionError: no PostgreSQL user name specified in startup packet

对错误的谷歌搜索返回的相关结果数量少得惊人。

任何帮助表示赞赏。

最佳答案

我刚刚通过更改我的 config.json 并使用不同的 heroku 命令顺序解决了这个问题:

首先我必须推广 heroku db: instructions for promoting db 然后改变我的
config.json
到以下几点:

"production": {
"use_env_variable": "DATABASE_URL"
}

然后在终端中运行以下命令:
heroku run bash
现在在heroku bash中:
sequelize db:migrate
我仍然不确定为什么在 config.json 中指定 db url 的每个键会给我一个错误,因为它们应该完全相同。

关于heroku - 尝试在 Heroku 上运行迁移时出现 Sequelize 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27852321/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com