firebase - travis ci 在 firebase 托管上部署失败
问题描述
我正在尝试将 travis ci 集成到我的 firebase 应用程序中以自动部署,但它无法显示 401 错误。这是我的 .travis.yml
language: node_js
node_js:
- '8'
deploy:
provider: firebase
token:
secure: "BnzKtrzBaI/uLHoezYpBVqQ/VwhIyil...n0jAuBNrTI="
message: build $TRAVIS_BUILD_NUMBER $TRAVIS_BRANCH/$COMMIT_HASH
我收到以下错误:
Error: HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
我不确定出了什么问题。
解决方案
I haven't used the provider
function in Travis CI before, but another option of deploying to Firebase hosting is to install firebase-tools
and use the CLI.
language: node_js
node_js: 8
before_script:
- npm install firebase-tools -g
script:
- firebase deploy --only hosting --token "BnzK...rTI="
-- Edit: More information on Cloud Functions
and Branch Filters
. --
If you're deploying Cloud Functions as well, you'll need to install the node_modules
on travis before you can deploy.
language: node_js
node_js: 8
before_script:
- npm install firebase-tools -g
- cd functions && npm install
script:
- firebase deploy --only hosting,functions --token "BnzK...rTI="
If you want to only deploy when changes are made to the master
branch you can add in this filter.
language: node_js
node_js: 8
before_script:
- npm install firebase-tools -g
- cd functions && npm install
script:
- firebase deploy --only hosting,functions --token "BnzK...rTI="
branches:
only:
- master
推荐阅读
- javascript - 我们如何将一个单元格(gsheet 响应)中的多项选择答案(来自 gform)声明为数组中的单独值?(气体)
- matlab - 在Matlab中找到epsilon的机器值
- php - PHP:在字符出现 X 次后从字符串中删除所有字符
- python - 在 aws lambda 上运行时 openpyxl 不显示图像(可能是由于 Pillow 的问题?)
- palantir-foundry - 在 Foundry 代码存储库中,如何从 Python 转换中记录调试消息?
- python - 在条形图python上设置y轴标签、范围、限制
- swift - SwiftUI - @State 属性未更新
- html - 单击Angular时如何修复容器向上移动
- python - 为 ord() 指定多个字符
- palantir-foundry - 在 Foundry 中,是否可以从级联导入中提取原始文件名?