Firebase操作托管部署失败,并显示RequestError(集成无法访问资源)
我正尝试遵循https://firebase.google.com/docs/hosting/github-integration开始自动推送我的代码由Firebase托管。
我最终得到了一个Github Actions.yml文件,看起来像这样:
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools
name: Deploy to Firebase Hosting on PR
'on': pull_request
jobs:
build_and_preview:
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: |
cd front
echo "$ENV_DEVELOPMENT" > .env.development
PWD=$(pwd)
npm install
sh -ac ". $PWD/.env.development; npm run build"
env:
ENV_DEVELOPMENT: ${{ secrets.ENV_DEVELOPMENT }}
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_MYPROJECT }}'
projectId: myproject
一直到最后一个破折号,也就是uses: FirebaseExtended/action-hosting-deploy@v0
,它都运行得很好。
我得到这个错误:
Run FirebaseExtended/action-hosting-deploy@v0
/home/runner/work/_actions/FirebaseExtended/action-hosting-deploy/v0/bin/action.min.js:3759
const error = new RequestError(message, status, ***
^
RequestError [HttpError]: Resource not accessible by integration
at /home/runner/work/_actions/FirebaseExtended/action-hosting-deploy/v0/bin/action.min.js:3759:31
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async createCheck (/home/runner/work/_actions/FirebaseExtended/action-hosting-deploy/v0/bin/action.min.js:5680:17)
at async run (/home/runner/work/_actions/FirebaseExtended/action-hosting-deploy/v0/bin/action.min.js:11435:14) ***
status: 403,
headers: ***
'access-control-allow-origin': '*',
...
'x-xss-protection': '0'
***,
request: ***
method: 'POST',
url: 'https://api.github.com/repos/mygithubuser/myproject/check-runs',
headers: ***
accept: 'application/vnd.github.v3+json',
'user-agent': 'octokit-core.js/3.2.4 Node.js/16.16.0 (linux; x64)',
authorization: 'token [REDACTED]',
'content-type': 'application/json; charset=utf-8'
***,
body: '***"name":"Deploy Preview","head_sha":"27df35c365f7289ac219329aeb45824ac2fde64a","status":"in_progress"***',
request: ***
agent: Agent ***
_events: [Object: null prototype] ***
free: [Function (anonymous)],
newListener: [Function: maybeEnableKeylog]
***,
_eventsCount: 2,
_maxListeners: undefined,
default port: 443,
...
maxCachedSessions: 100,
_sessionCache: ***
map: ***
'api.github.com:443:::::::::::::::::::::': [Buffer [Uint8Array]]
***,
list: [ 'api.github.com:443:::::::::::::::::::::' ]
***,
[Symbol(kCapture)]: false
***,
hook: [Function: bound bound register]
***
***,
documentation_url: 'https://docs.github.com/rest/reference/checks#create-a-check-run'
***
起初,我以为这是我的云服务工作人员的权限错误,但如果我进入我的www.example.com到IAM,我可以看到一个github-action与角色'API键查看器,云运行查看器,Firebase身份验证管理员和Firebase托管管理员'.为了看看是否有区别,我还添加了所有者角色.console.cloud.google.com to IAM, I can see a github-action with the roles 'API Keys Viewer, Cloud Run Viewer, Firebase Authentication Admin and Firebase Hosting Admin'. To see if makes a difference, I also added the Owner role.
还有什么建议我可以试试吗?
2条答案
按热度按时间uqcuzwp81#
我也遇到了这个错误,所以我解决这个问题的方法是:
1.在你的github存储库点击设置
1.单击操作,然后单击常规
1.查找工作流权限部分
1.选择第一个选项“读写权限”,然后选择复选框“允许GitHub操作创建和批准拉取请求”请参阅附件以供参考
让我知道如果这也解决了你的问题。
shyt4zoc2#
试试这个:确保启用GITHUB_TOKEN的读和写权限.要做到这一点,点击你的github组织(不是repo),设置,操作,常规,向下滚动到工作流权限