How To Fix Firebase Hosting Errors When Using Automatic Deployment With GitHub

Firebase category image

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.

?

Tip

A preview channel in Firebase Hosting is a temporary channel that usually lives for a week by default and is then automatically deleted. It has its own URL and is independent of the live 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!

GitHub Action error while deploying to Firebase Hosting. The error status code 403 indicates that the GitHub Action does not have enough permissions to execute the deployment.
GitHub Action error while deploying to Firebase Hosting. The error status code 403 indicates that the GitHub Action does not have enough permissions to execute the deployment.

In your GitHub project, click on SettingsActionsGeneral. 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”.

Screenshot of the GitHub repository settings. Activate the radio button “Read and write permission” and enable the check box “Allow GitHub Actions to create and approve pull requests” to fix the errors above.
Screenshot of the GitHub repository settings. Activate the radio button “Read and write permission” and enable the check box “Allow GitHub Actions to create and approve pull requests” to fix the errors above.

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.

Successful preview channel deployment of the GitHub Action to Firebase Hosting. Details about the channel are added as a comment in the pull request.
Successful preview channel deployment of the GitHub Action to Firebase Hosting. Details about the channel are added as a comment in the pull request.

Conclusion

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.

Firebase Hosting

Host your web apps, microservices, dynamic, and static content with this powerful yet simple solution from Firebase!


Want More Flutter Content?

Join my bi-weekly newsletter that delivers small Flutter portions right in your inbox. A title, an abstract, a link, and you decide if you want to dive in!

Become A Firebase Expert!

Take a deep dive into Firebase and learn how to really handle their services. This ebook makes you an instant Firebase professional!

Flutter ❤️ Firebase

Get started with Firebase and learn how to use it in your Flutter apps. My detailed ebook delivers you everything you need to know! Flutter and Firebase are a perfect match!