Search code examples
firebasednsfirebase-hosting

Firebase hosting does not deploy on custom domain


i've deployed my app on firebase hosting and then i have bought a custom domain from Google Domains.

Then i have proceeded in this way:

  1. Go to firebase hosting control panel
  2. Click on Add Custom Domain
  3. Then add my domain in like this my-domain.com

So, at this point firebase give me an A Type Record to add to my dns configuration in google domains that look like this: google domains setup

I leave empty the host name input, then i add google firebase ip infos in "value" input and save both on firebase and google domains.

But nothing happen.

Firebase told me that i require a configuration and domains says that is all okay.

firebase and domains response


Solution

  • It will take some time, usually in the magnitude of minutes (rather than hours, and certainly not days) to start working, but looking at the "google domains setup" screenshot, I believe there is an issue with the DNS setup as the screenshot shows an incomplete configuration.

    For anyone else looking to resolve this, I will write the complete steps to help resolve the issue, for Firebase and Google Domains: retrace these steps, since any one of them could be the source of the issue.

    First on Firebase Hosting:

    1. Click add custom domain
    2. Enter the custom domain or subdomain in the provided input box (note the difference!)
    3. Lastly firebase will show a screen with details of how to configure the DNS. The "quick setup" is sufficient for new sites. It will look like this:

    Firebase shows DNS configuration info


    The next step is to enter this information into the domain name provider's console, in this case Google domains.

    On Google Domains console:

    1. Go to DNS configuration, then "custom records" section
    2. Since this is a newly registered domain, there should not be existing records, but otherwise see the blue star note above: "Remember to remove..."
    3. "create new record"
    4. To get this last part correctly requires paying attention to the difference in how to configure domain/subdomain, so I will present them separately to highlight the difference:

    Option A) subdomain configuration e.g. www.mywebsite.com

    The entry in the DNS configuration should look as follows, where the data is the IPv4 address from Firebase. Note for "host name", enter the subdomain-part only:

    Host name Type TLL Data
    www A 3600 255.255.255.255

    Option B) domain name configuration e.g. mywebsite.com

    The host name entry is intentionally left blank, and data is the IPv4 obtained from Firebase.

    Host name Type TLL Data
    A 3600 255.255.255.255

    Save the DNS changes then wait. If you return to Firebase hosting, it may say "needs setup" ... then "pending" ... while these changes are being propagated and waiting for a SSL cert to be provisioned. The state should say "pending" very soon after applying the DNS changes (< 5 min).

    Check the (sub)domain periodically in the browser, to see when it starts working (it took me about 20 minutes to give you some anecdotal metric, and it started working before the "pending" label had been resolved in Firebase). Eventually Firebase will switch the state label to "connected" to complete the configuration.