codelab-friendlyeats-flutter icon indicating copy to clipboard operation
codelab-friendlyeats-flutter copied to clipboard

15. Deploy your web app to Firebase Hosting

Open AndreSand opened this issue 5 years ago • 7 comments

Hi, it looks like in the CodeLab: Multi-platform Firestore Flutter, step 15 is missing this command firebase init hosting.

https://codelabs.developers.google.com/codelabs/friendlyeats-flutter?hl=en&continue=https%3A%2F%2Fcodelabs.developers.google.com%2F%3Fcat%3Dflutter#14

Commands:

  1. flutter build web
  2. firebase init hosting 3. firebase deploy --only hosting

If we don't run the command firebase init hosting we get the below error:

Target dart2js failed: Exception: Error: FileSystemException: Cannot open file, path =
--
/Users/asandoval/dev/flutter/friendlyeats-flutter/.dart_tool/flutter_build/ed4fd20d65140e369640cdfbaae21d2e/app.dill
(OS Error: No such file or directory, errno = 2)

Thanks, Andres

AndreSand avatar Dec 03 '20 00:12 AndreSand

Thanks @AndreSand. You saved the day.

megataps avatar Dec 07 '20 07:12 megataps

This is a very good point @AndreSand, thanks for reporting! There's a new process for publishing codelabs that I need to look into, but I'll add the firebase init hosting command ASAP.

In the meantime, I'll leave this issue open so others can find it.

ditman avatar Dec 17 '20 22:12 ditman

I suspect the firebase.json is missing an extra &, causing both the clean and build commands to run concurrently:

https://github.com/FirebaseExtended/codelab-friendlyeats-flutter/blob/903643c8c9019b6b8302ef4573ebdd5541cdd695/firebase.json#L3

pingbird avatar Dec 21 '20 03:12 pingbird

@megataps @ditman Thank you for creating the CodeLab tutorial! I was able to follow the tutorial to create this demo app: https://happy-hour-san-jose.web.app/#/

AndreSand avatar Dec 31 '20 06:12 AndreSand

Thank you @AndreSand indeed they are missing that step, I also see some errors like they mention develop section where it should be Build and database where it should be Cloud Firestore, thanks for reporting this, I wonder why they haven't updated it

pescamillam avatar Jan 16 '21 17:01 pescamillam

Thanks for the report. An update is in progress.

domesticmouse avatar Mar 18 '21 04:03 domesticmouse

I had a difficult time getting this step working. This surprised me because when I ran the Firebase web codelab "Friendly Chat" last week, deploying the app went very smoothly. Anyhow, I think the main issue was my answers to the 'firebase init hosting' prompts. I tried several different things for the "public directory" directory and only after comparing my directory tree to the 'done' branch did I realize that the 'build' dir was built during the deployment. Anyhow, here are the details of what I did to get it working in case it helps others or is deemed worthy of being added to the instructions:

**\friendlyeats-flutter2> flutter clean # Suggested by earlier comments in this issue (9) **\friendlyeats-flutter2> flutter build web Building without sound null safety # See issue 15 **\friendlyeats-flutter2> firebase init hosting ? Are you ready to proceed? (Y/n) y ? What do you want to use as your public directory? (public) build\web # <- The ans I got wrong multiple times! ? Configure as a single-page app (rewrite all urls to /index.html)? (y/N) n ? Set up automatic builds and deploys with GitHub? (y/N) n ? File build\web/404.html already exists. Overwrite? (y/N) y # Odd since I did a 'flutter clean'. Maybe n would have worked too? ? File build\web/index.html already exists. Overwrite? (y/N) n **\friendlyeats-flutter2> firebase deploy --only hosting

Any suggestions for the proper answer to the two 'overwrite?' questions?

j-vasil avatar Apr 14 '21 16:04 j-vasil