Flutter web app won't deploy to Firebase hosting

Thomas David Kehoe

My Flutter app looks great in the Chrome (web) emulator and running on a local server.

I navigated to this directory:

Users/TDK/StudioProjects/kabbalah/build/web/

I installed the Firebase CLI tools and then ran

firebase init hosting

I wasn't sure about this question:

? Configure as a single-page app (rewrite all urls to /index.html)? (y/N) 

I responded y. The response was

✔  Firebase initialization complete!

Then I ran

firebase deploy --only hosting

The response is

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/kabbalah-numerology/overview
Hosting URL: https://kabbalah-numerology.web.app

When I go to the Project Console I see

Deployed

When I go to https://kabbalah-numerology.web.app I get this screen:

enter image description here

Shouldn't I see my web app? Did I deploy from the wrong directory?

I opened Safari to check if Chrome was cacheing an old webpage but I got the same screen.

I put this code block into index.html. It made no difference.

<body>
<script>
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import { getAnalytics } from "firebase/analytics";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries

// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
  apiKey: "my-super-secret-key",
  authDomain: "kabbalah-numerology.firebaseapp.com",
  projectId: "kabbalah-numerology",
  storageBucket: "kabbalah-numerology.appspot.com",
  messagingSenderId: "my-sending-id",
  appId: "my-app-id",
  measurementId: "my-measurement-id"
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
</script>
</body>
Frank van Puffelen

Check the firebase.json file, which controls your hosting setup. Most likely the public folder in there, which determines from what directory files are served, points to the wrong location.

I typically run firebase init in the root of my project, and then point public in firebase.json to the output of the flutter web build.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Firebase hosting doesn't let me deploy bc firebase-functions is outdated

Angular 6.0 firebase hosting deploy not working

Hosting nodeJS app with firebase

Can I deploy react.js web app to a share hosting?

Web app to write data from shared hosting webpage to firebase firestore

Using Firebase Hosting to deploy the angular application

Firebase Hosting deploy gives HTTP Error 401

Firebase sample function "generateThumbnail" won't deploy

How to host Flutter Web (Hummingbird) on Firebase Hosting

firebase deploy hosting from remote (google storage)

Stop saving in cache memory Flutter web Firebase hosting

Firebase Hosting - Flutter Web App hosting of extra .html page

Firebase hosting deploy with serviceaccount fails with 403

Deploy Quasar SSR vue/node app to Firebase Hosting

Changes not reflecting on flutter web deploy after firebase project owner changed

web app doesn't deploy properly

Hosting web app on xampp

Firebase hosting won't register Polymer

is it possible to host Firebase web app which use Firestore with Firebase Hosting?

Flutter websockets working in local web but not in Firebase Hosting

Deploy website on Firebase Hosting with specific path

Firebase functions config won't deploy

How to deploy web app with nuxt firebase?

React app deploy complete with firebase but i did not get a hosting url ? What i do now for successful deploy

Disable Firebase hosting github deploy

flutter web WhatsApp web won't open

Deploy Nuxt 3 website to Firebase Hosting

Flutter Web App with Firebase Not caching credentials

Video Player plugin for Flutter not working correctly when deploy to Firebase hosting