Fix a pipeline error with status code 403 and the message “Resource not accessible by integration”
Firebase Hosting offers a neat feature to automatically deploy a web app to a preview channel when a new pull request is created on GitHub. With that feature, testers can verify changes and give constructive feedback while the productive web app is not affected. But without proper configuration, the GitHub Action can run into errors. So here is how to fix Firebase Hosting errors when using automatic deployment with GitHub.
Let’s assume, your GitHub setup is already in place. If not, then here is a short description of how you can set it up. Your workflow looks like this:
- Create a new branch
- Make some changes
- Commit and push the changes
- Create a pull request on GitHub
The GitHub Action is triggered and executes the workflow. In my example, I am using a Flutter web app. Before the deployment, I installed the GitHub Action for Flutter to build the web app. In the next step, the app gets deployed to a preview channel.
If you are running into a 403 error (see image below) during this step, your configuration of your GitHub project is wrong. But don’t worry, the fix is easy!
In your GitHub project, click on Settings → Actions → General. Scroll down to Workflow permissions, enable the option “Read and write permissions”, and activate the check box “Allow GitHub Actions to create and approve pull requests”.
Rerun your pipeline and the errors won’t appear again. You should see an additional comment in your pull request with all details about the preview channel. The preview channel lives for 7 days before it automatically gets deleted. This should give you enough time to test the changes thoroughly.
In this article, you learned how to fix Firebase Hosting errors when using automatic deployment with GitHub. The solution is pretty simple but you have to know what you need to do. This shouldn’t be a problem for you in the future anymore.