【发布时间】:2020-04-14 11:59:43
【问题描述】:
我正在尝试使用我的 Github 中的 Heroku 部署我的应用程序。 我将我的 dotenv 值放在配置变量中,但一个值引用了一个 json 文件,heroku 无法访问该文件
GCS_KEYFILE = file.json
这是json:
{
"type": "service_account",
"project_id": "",
"private_key_id": "",
"private_key": "=\n-----END PRIVATE KEY-----\n",
"client_email": "",
"client_id": "",
"auth_uri": "",
"token_uri": "",
"auth_provider_x509_cert_url": "",
"client_x509_cert_url": "
}
如何让 heroku 访问该文件?
更新
我尝试了下面的答案,但对我不起作用。在配置变量中,我尝试添加 json。现在我收到以下错误消息:
2020-04-14T14:40:53.370477+00:00 app[web.1]: Error: Could not authenticate request
2020-04-14T14:40:53.370493+00:00 app[web.1]: ENOENT: no such file or directory, open '/app/{
type": "service_account",
"project_id": "",
"private_key_id": "",
"private_key": "=\n-----END PRIVATE KEY-----\n",
"client_email": "",
"client_id": "",
"auth_uri": "",
"token_uri": "",
"auth_provider_x509_cert_url": "",
"client_x509_cert_url": "
2020-04-14T14:40:53.370500+00:00 app[web.1]: at /app/node_modules/gcs-resumable-upload/build/src/index.js:235:19
2020-04-14T14:40:53.370501+00:00 app[web.1]: at /app/node_modules/google-auto-auth/index.js:27:9
2020-04-14T14:40:53.370501+00:00 app[web.1]: at /app/node_modules/google-auto-auth/index.js:233:9
这是我尝试以下答案时的错误消息:
Error: You have to specify credentials key file for Google Cloud Storage to work.
我尝试部署的代码可以找到here
【问题讨论】:
标签: json heroku deployment