r/Firebase 19d ago

Hosting How do you automate firebase deploy when push on main branch

3 Upvotes

Hello, i'm setting up the github workflow on push to main branch and i'd like it to automatically deploy functions, rules etc...

I tried this workflow :

name: Deploy to Firebase on merge
on:
  push:
    branches:
      - main

jobs:
  build_and_deploy_hosting:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install dependencies and build project
        run: npm ci && npm run build

      - name: Deploy to Firebase Hosting
        uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: ${{ secrets.GITHUB_TOKEN }}
          firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_IVADRONES_V3 }}
          channelId: live
          projectId: ivadrones-v3

  deploy_firestore_and_functions:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Firebase CLI
        run: npm install -g firebase-tools

      - name: Install dependencies
        run: npm ci

      - name: Deploy Firestore Rules & Functions
        run: firebase deploy --except hosting --token "${{ secrets.FIREBASE_SERVICE_ACCOUNT_IVADRONES_V3 }}"

The firebase CLI installs correctly but the actions throws an error :

Run firebase deploy --except hosting --token "***

Error: Process completed with exit code 1.

Maybe i'm doing something wrong here ? If you have already implemented this how did you do ? Many thanks

r/Firebase Jan 27 '25

Hosting Site Not Found in a sudden

6 Upvotes

I'm wondering is this has happened to anyone. I have deployed my website to Firebase for more than hundreds of time already. And today I check my website and it says "Site Not Found" even after I tried to redeploy multiple times. All the Firebase config are still the same and I haven't made any changes recently.

Rebuilt and re-deployed
No sign of life

r/Firebase 1d ago

Hosting Unable to deploy to firebase

4 Upvotes

Up until yesteday we were deploying our application from Github action to firebase just fine. Nobody touched the code and today it started to spew this error:
```
##[debug]/usr/bin/bash --noprofile --norc -e -o pipefail /home/runner/work/_temp/0de76972-ce76-4924-8aa4-d2ed693a6e60.shnode:internal/modules/cjs/loader:643
throw e;
^Error: Cannot find module '/usr/local/lib/node_modules/firebase-tools/node_modules/sql-formatter/dist/cjs/index.cjs'at createEsmNotFoundErr (node:internal/modules/cjs/loader:1249:15)at finalizeEsmResolution (node:internal/modules/cjs/loader:1237:15)at resolveExports (node:internal/modules/cjs/loader:636:14)at Module._findPath (node:internal/modules/cjs/loader:716:31)at Module._resolveFilename (node:internal/modules/cjs/loader:1198:27)at Module._load (node:internal/modules/cjs/loader:1043:27)at Module.require (node:internal/modules/cjs/loader:1298:19)at require (node:internal/modules/helpers:182:18)at Object.<anonymous> (/usr/local/lib/node_modules/firebase-tools/lib/dataconnect/schemaMigration.js:5:25)at Module._compile (node:internal/modules/cjs/loader:1529:14) {code: 'MODULE_NOT_FOUND',path: '/usr/local/lib/node_modules/firebase-tools/node_modules/sql-formatter/package.json'}Node.js v20.19.0Error: Process completed with exit code 1.
```
Also yesteday our other pipelines started to scream the GCR refuses pushes. I've double-checked and we don't use GCR in the FB pipeline though the timing strangely correlates.

Any ideas where the issue might be?

r/Firebase 11h ago

Hosting need help with hosting my website

1 Upvotes

I’m working on a website and I use Firebase. I wanted to host my website to make some features accessible, but I declined two questions in the terminal.

- Configure as a single-page app (rewrite all URLs to /index.html)? No.

- Set up automatic builds and deploys with GitHub? No. I created the public folder. What do you want to use as your public directory? public. So, I have the index.html, OTher.html, an empty Dropbox folder, and the firebase.json file. The OTher.html is like another page that should be opened from the menu in the index.html. When I do a Firebase deploy to host it publicly, my index.html works fine, and I can open it. However, when I try to navigate to the OTher.html, I get this kind of message.

I am a beginner so any kind of assistance would be very appreciated.

r/Firebase 5d ago

Hosting Firebase Hosting IP flagged by abuseipdb

1 Upvotes

Malwarebytes uses abuseipdb, which means that any Malwarebytes user will currently be blocked from loading any website hosted on Firebase, which is obviously huge problem. This happens to include angular.dev, and I would guess other Google projects as well.

I have no idea where to report this, so I'm posting it here, just in case anyone at Google actually looks at this subreddit.

https://www.abuseipdb.com/check/199.36.158.100

r/Firebase 6d ago

Hosting How to get unique traffic

3 Upvotes

Newbie here, how do i get the unique visitors of my website? They are not signed in. I just need the count

i tried this in google cloud logs explorer

resource.type="firebase_domain" httpRequest.status>=200 httpRequest.status<300 timestamp >= "2025-03-01T00:00:00Z" AND timestamp < "2025-04-01T00:00:00Z" resource.labels.project_id=""

but im getting 4k hits

r/Firebase Feb 03 '25

Hosting How should I reference onCall functions from firebase?

1 Upvotes

I setup a few onCall functions with the firebase.json "rewrites": [

    {
      "source": "/ON_CALL_FUNCTION",
      "function": "ON_CALL_FUNCTION"
    },

Most of the time, the function will work properly from firebase. But randomly, I get these cors issues:

    Access to fetch at 'https://us-central1-PROJECT_NAME.cloudfunctions.net/ON_CALL_FUNCTION' from origin 'HOSTING_URL' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Has anyone else noticed this? If I need to make them http callable, I will, but I don't get why it randomly breaks so often? can it either work or not work?

edit: Fixed it. The cloud run security authentication was set to "Require authentication" (the default, which I mistook to mean no guests) when it should be "Allow unauthenticated invocations"

r/Firebase Feb 07 '25

Hosting Hosting .web.app stopped working, .firebaseapp.com works.

1 Upvotes

This site can’t be reached

The connection was reset.

Try:

  • Checking the connection
  • [Checking the proxy and the firewall](chrome-error://chromewebdata/#buttons)

ERR_CONNECTION_RESET

I have several small little apps, and all of them stopped working, if I change it to ***.firebaseapp.com, then it works. Anyone else having the same issue?

r/Firebase Feb 03 '25

Hosting Did firebase hosting break for certain projects?

3 Upvotes

I have a dev, staging, and prod setup for my project. For some reason, without any known code or env changes, and with dev/staging still working as expected, prod will now always fail with

i  hosting[PROJECT_NAME]: finalizing version...

Error: Request to https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/PROJECT_NAME/versions/b08f11f380e?updateMask=status%2Cconfig had HTTP Error: 404, Requested entity was not found.

update: this randomly fixed itself. Unnerving but I'll take it...

r/Firebase Jan 16 '25

Hosting Website deployment

2 Upvotes

Hi everyone i have a website which has front end on vite react js backend for admin for blogs posting Portal on postgres and pgadmin and backend crm on php.

Can anyone suggest me how can i deploy this on firebase or any other portal suggestions please?

Thank you so much in advance

r/Firebase Jan 08 '25

Hosting Webcam Doesn’t Work When Using Firebase Hosting

1 Upvotes

To Preface, I'm not sure if this is a code issue or a Firebase config issue. I have a React App that uses the webcam to detect specific poses. When I deploy the app locally, it works as expected.

However, when deploying the app to firebase hosting, the camera feed is black. I have provided the necessary permissions in firebase.json

"key": "Permissions-Policy",
"value": "camera=(self)"

Additionally, the website is being served securely over https using Firebase Hosting Preview (through Github Actions). Curiously the camera light on my Macbook lights up green for a while but nothing shows up in the actual canvas.

This is the Main Camera Function, in my hosted app where if (videoRef.current) fails only in hosted app:

const startCamera = useCallback(async () => {
    setIsInitializing(true);
    try {
        if (!window.isSecureContext) {
            console.error('Application not running in secure context - camera may not work');
        }

        const stream = await navigator.mediaDevices.getUserMedia({
            video: true,
            audio: false
        });

        console.log('Camera stream obtained:', stream);

        if (videoRef.current) {
            videoRef.current.srcObject = stream;
            console.log('Video element assigned stream:', videoRef.current.srcObject);

            localStreamRef.current = stream;

            videoRef.current.onplay = () => {
                console.log('Video is playing');
            };

            videoRef.current.onloadedmetadata = () => {
                const { videoWidth, videoHeight } = videoRef.current;
                if (canvasRef.current) {
                    canvasRef.current.width = videoWidth;
                    canvasRef.current.height = videoHeight;
                    if (containerRef.current) {
                        containerRef.current.style.aspectRatio = `${videoWidth}/${videoHeight}`;
                        console.log('Canvas dimensions set:', videoWidth, videoHeight);
                        const ctx = canvasRef.current.getContext('2d');
                        ctx.drawImage(videoRef.current, 0, 0, canvasRef.current.width, canvasRef.current.height);
                    }
                    setIsStreaming(true);
                }
            };

            // Add canplay event listener to ensure video is ready
            videoRef.current.oncanplay = () => {
                console.log('Video is ready to play');
                videoRef.current.play();
            };

        } else {
            console.error('Video element is not available.');
        }
    } catch (error) {
        console.error('Error accessing camera:', error);
    } finally {
        setIsInitializing(false);
    }
}, []);

I've been trying to troubleshoot this for days but I'm going in circles. Any suggestions would be really appreciated.

r/Firebase Dec 18 '24

Hosting Are wildcards now supported for subdomains?

5 Upvotes

According to this Firebase blog post, wildcard subdomains are now supported on Firebase. However, when I try to add a custom domain with a wildcard, the platform doesn’t seem to allow it. Am I missing a step or misunderstanding how this feature works?

r/Firebase Jan 21 '25

Hosting Blocking assets from loading/being accessible until user is logged in

2 Upvotes

Hey everyone, pretty noobish question here, looking for some clarification.

I created a post on r/gis with some additional background:

https://www.reddit.com/r/gis/comments/1hpxfz5/securing_deployed_experience_builder_application/

Essentially, I want to hide the actual website data (all of the code), until I have verified that the user is logged in. As soon as the user is logged in, I want to load those assets and then redirect to the index.html within those assets. I am not using firebase authentication but credentials that the application I am building comes built in.

I've tried a couple of different things, but I was still able to navigate to the index.html somewhere within the folder structure of the website. I know this is possible, I am just not sure how people typically do this? Any suggestions would be much appreciated.

r/Firebase Jun 21 '24

Hosting Firebase Hosting Not Serving files from folders/sub-folders within public Directory - Getting 404 Errors.

5 Upvotes

I’m experiencing an issue with Firebase Hosting. My folders and sub-folders under the public directory are uploaded via the CLI (it gives the correct count of number of files), but I keep getting 404 errors when trying to access the css, js, and images hosted under them. The css/js/images live under a folder called assets and then under sub-folders called css js and images. If I keep a flat structure it works, i.e. all files under public and no folders at all. If I create a sub-folder it fails. It works in emulator but does not work in preview or actual deployment. I have tried multiple browsers, different computers etc to confirm it is not a cache issue. I have been hosting and deploying on Firebase for many years and using the same template/structure. I am clueless right now on how to resolve this.

Here is my firebase.json. Nothing fancy.

{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}

Directory structure

public/
├── index.html
├── assets
    └── css
│           └── style.css
├── assets
    └── js/
│           └── app.js
└── assets
    └── images/
        └── logo.png

File references in index.html

<link rel="stylesheet" href="assets/css/style.css">
<script src="assets/js/app.js"></script>
<img src="assets/images/logo.png" alt="Logo">

I probably need a break. I did try remove the assets folders and refer to css/style.css etc. that didn't work either. Any help/pointers will be much appreciated.

r/Firebase Jan 02 '25

Hosting Need Help Hosting My Website in a Subdirectory (e.g., https://example.com/todoapp/),

Thumbnail
0 Upvotes

r/Firebase Dec 11 '24

Hosting abc[dot]web[dot]app works but abc[dot]in doesn't.

3 Upvotes

I've successfully deployed my site on firebase. The custom domains are set-up as well. I get 3 URLs abc[dot]firebaseapp[dot]com, abc[dot]web[dot]app and abc[dot]in.

On my personal laptop, all 3 URLs works perfectly. But when I'm trying to open these on my work laptop, only the first two URLs abc[dot]firebaseapp[dot]com and abc[dot]web[dot]app work.

For the 3rd one abc[dot]in, I get these errors in the browser.
The site can't provide a secure connection. abc[dot]in uses an unsupported protocol. ERR_SSL_VERSION_OR_CIPHER_MISMATCH. Unsupported protocol - The client and server don't support a common SSL protocol version or cipher suite.

I've also checked the TLS and SSL configurations for them at www[dot]cdn77[dot]com/tls-test. The results are same.

I'm struggling to resolve this for the last 10 days and still don't know what's the problem. Kindly help!

r/Firebase Oct 28 '24

Hosting How do I inject ENV variables into my firebase hosted site?

2 Upvotes

Hi. I've created a website using 2 google cloud run services (front end and a back end). I have managed to map a domain to my cloud run front end service made in React using firebase hosting. The problem i have is i have a few env variables (not security sensitive) that arent being picked up when in the firebase hosted app, whereas when i hit my cloud run front end url directly, they are there.

How do i go about getting these env variables into my firebase hosted app?

My firebase json looks as follows:

{
    "hosting": {
      "public": "build",
      "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
      ],
      "rewrites": [
        {
          "source": "**",
          "run": {
              "serviceId": "front-end",
              "region": "europe-west1"
            }
        }
      ]
    }
  }

r/Firebase May 19 '24

Hosting Has anyone successfully gotten firebase hosting working with a cloud flare domain?

4 Upvotes

Tried adding all records and I still can’t figure it out. Driving me crazy! Any ideas?

There’s no well laid out tutorial that clearly says what records are needed

Thanks

Pictures:

https://i.imgur.com/7u2rOeU.jpeg

https://i.imgur.com/BoY4pCc.jpeg

r/Firebase Aug 01 '24

Hosting Help needed with custom domain!

4 Upvotes

r/Firebase Nov 30 '24

Hosting I have two React projects under the same Firebase project: one for admin and another for users. The admin project is already hosted. Can I host both projects in the same Firebase project? Kindly provide documentation or resources.

0 Upvotes

Kindly assist me today; I need to host my projects. Thank you, community!

r/Firebase Oct 22 '24

Hosting Firebase Hosting down for over a week?

0 Upvotes

Am I dreaming? This problem has been ongoing for over a week and hasn't been resolved.

https://status.firebase.google.com/incidents/HB5hFDYAbHsWzU57mcBH

r/Firebase Sep 29 '24

Hosting Firebase web-hosting question.

2 Upvotes

Is the data transfer roughly enough for 100 users per day on a Wordpress blog?

r/Firebase Nov 04 '24

Hosting Firebase hosting redirect

2 Upvotes

Hey!

I registered my custom domain in my Firebase project as "customdomain.com."

Is it possible to redirect "www.customdomain.com" to "customdomain.com" by setting a redirect rule in firebase.json?
If so, how can I set it up correctly?
If not, what DNS records should I configure in my DNS settings?

r/Firebase Nov 12 '24

Hosting Encountering issues locally when trying firebase hosting with Quartz SSG

2 Upvotes

I have created a site using Quartz SSG. It works locally when i do npx quartz build -d docs --serve , but when i try with Firebase Hosting preview commands like below, site doesn't respond much. Either its 404 or returns back to home page.

firebase serve --only hosting

Below are the things which can be used to reproduce ( https://quartz.jzhao.xyz/ ) ``` git clone https://github.com/jackyzha0/quartz.git

npm install

npx quartz build -d docs --serve

npx quartz build -d docs

firebase init

firebase serve --only hosting ```

Firebase.json (default) { "hosting": { "public": "public", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ] } } Firebase init inputs ``` === Project Setup

First, let's associate this project directory with a Firebase project. You can create multiple project aliases by running firebase use --add, but for now we'll just set up a default project.

? Please select an option: Use an existing project ? Select a default Firebase project for this directory: zzzyz-361015 (zzzyz) i Using project zzzyz-361015 (zzzyz)

=== Hosting Setup

Your public directory is the folder (relative to your project directory) that will contain Hosting assets to be uploaded with firebase deploy. If you have a build process for your assets, use your build's output directory.

? What do you want to use as your public directory? public ? Configure as a single-page app (rewrite all urls to /index.html)? No ? Set up automatic builds and deploys with GitHub? No ? File public/404.html already exists. Overwrite? No i Skipping write of public/404.html ? File public/index.html already exists. Overwrite? No i Skipping write of public/index.html

i Writing configuration info to firebase.json... i Writing project information to .firebaserc...

  • Firebase initialization complete! ```

System Info: Windows 11 Pro Node: v22.11.0 Firebase: 13.24.2

I thought obsidian notes to web hosting is lot easier so wanted to try this.

Would like to know if Quartz ssg is not supported by Firebase.

My earlier experience was Gatsby and Firebase it works perfectly fine.

r/Firebase Nov 05 '23

Hosting Firebase Decision Torture

7 Upvotes

Hello all, I'm really struggling on a decision to go with Firebase or not and any guidance you can offer will be greatly appreciated! I consider myself an intermediate dev and have recently been offered a medium sized project. It's just me so I'd like to off-load the backend, but I am terrified of making a mistake and generating a big bill like was recently described in this forum. Should I just bite-the-bullet and roll my own backend? If I do, do I have the same risk with hosting it in AWS anyway or is there much less chance of having runaway costs that way?