Hi – I’m following all the setup instructions from the Firebase Web App with ESP32 and ESP8266 book. All goes well through to page 125 from where I should expect to see that my project has files within my project folder i.e. 404.html and index.html etc after VS Code says it has been successful. I tried again with no success. I’m using a Mac with the latest OS software updates including VS Code. My firebase console database works perfectly with my ESP32. The following shows my deploy from VS terminal.
=== 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.
i .firebaserc already has a default project, using peter-iot-app.
=== Database Setup
i database: ensuring required API firebasedatabase.googleapis.com is enabled…
✔ database: required API firebasedatabase.googleapis.com is enabled
Firebase Realtime Database Security Rules allow you to define how your data should be
structured and when your data can be read from and written to.
✔ Database Rules for peter-iot-app-default-rtdb have been written to database.rules.json.
Future modifications to database.rules.json will update Realtime Database Security Rules when you run
firebase deploy.
=== 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? Yes
✔ Wrote public/404.html
? File public/index.html already exists. Overwrite? Yes
✔ Wrote public/index.html
i Writing configuration info to firebase.json…
i Writing project information to .firebaserc…
✔ Firebase initialization complete!
#########@######### %
Hi.
Everything seems fine until the Hosting section.
In which folder are you running those commands?
It should be an empty folder where you want to build your Firebase Web App.
Are you running those commands in a folder that already has files?
Regards,
Sara
I don’t have that book but I have had no end of issues trying to upload files with my Intel Mac mini. I tried both the plug-in for Arduino IDE as well as PlatformIO. Neither works for me.
It may be a folder issue like Sara says although I have completely reinstalled both IDE’s and still have the issue.
I have basically given up and just have all of the HTML code in line with my C++ code. Takes a bit more effort but it still works.
Note: I am using MacOS Big Sur 11.5.2, VS Code 1.62.1 and PIO 2.4.0.
Hi Steve.
Thanks for your answer, but in this case, it has nothing to do with that.
It is related to creating a Firebase project folder using VS code.
Regards,
Sara
Thanks Steve for your answer. I used the latest Arduino IDE without issues on my MacBook Air using MacOS Big Sur 11.6. I’ve followed the book without issues up until page 125 including using the esp32 with the BME sensor and I/O without issue including driving the esp32 from my Firebase console i.e. from within the Realtime Database. All great and I’m impressed thus far. In VS Code terminal I’ve had to use sudo in my commands to overcome Mac access issues and that could in part be my problem.
Sara – perhaps the following may help with your directory question for when I deployed
xxxx@Peters-MacBook-Air-84 Firebase-Project % sudo firebase deploy
Password:
=== Deploying to ‘peter-iot-app’…
i deploying database, hosting
i database: checking rules syntax…
✔ database: rules syntax for database peter-iot-app-default-rtdb is valid
i hosting[peter-iot-app]: beginning deploy…
i hosting[peter-iot-app]: found 2 files in public
✔ hosting[peter-iot-app]: file upload complete
i database: releasing rules…
✔ database: rules for database peter-iot-app-default-rtdb released successfully
i hosting[peter-iot-app]: finalizing version…
✔ hosting[peter-iot-app]: version finalized
i hosting[peter-iot-app]: releasing new version…
✔ hosting[peter-iot-app]: release complete
✔ Deploy complete!
Project Console: https://console.firebase.google.com/project/peter-iot-app/overview
Hosting URL: https://peter-iot-app.web.app
xxxx@Peters-MacBook-Air-84 Firebase-Project %
Having done that the files deployed ended up in my root directory as the following shows and not in my VS Code under ‘FIREBASE-PROJECT” (all caps) so I’ve screwed up somewhere but not sure where. My Public folder shows both the correct 404.html and index.html files (only them) and my ‘Firebase-Project’ (note non-caps) folder under my Documents directory is empty.
My Mac terminal list command i.e. ‘xxxx@Peters-MacBook-Air-84 ~ % ls’ shows that the following files are there
database.rules.json and firebase.json but not the 404.html nor index.html as these are in the Public folder above. An interesting mess I think I’ve created as all these should be in one folder under my VS Code project.
Trust you can help Sara
Hmmm. Perhaps use the Console app and monitor the system.log to see if there are any messages there when you compile?
Hmmm. Perhaps use the Console app and monitor the system.log to see if there are any messages there when you compile?
Sara – Further to above I reinstalled VS Code, NodeJS and added the extension as in your book. The needed $PATH was also made. To be more specific regarding the book it assumes a Windows PC. I’m using a Mac and starting with page 124 steps 4, 5 and 6 are not asked following Firebase Init. Page 125 step 7 is asked and correctly answered using your book -but step 8 shows the empty folder. The version of VS Code I’m using is 9.22.0. Your book at the time of writing was an earlier version. At no point am I receiving errors. Trust this helps.
I’ve looked at this further for those using a Mac. Unfortunately the book lacks the necessary instructions in places needed as a tutorial for Mac’s. My comment above about some of the steps not occurring given that important questions are not asked as in p124. I have however managed to get my project working without the VS Code creating the files under my project folder. I instead copied the necessary files into my project folder from elsewhere i.e. ‘public’ and ‘/user/xxxx’ folders and proceeded from there to complete the tutorial successfully. For my part the problem is now closed.
Hi Peter.
I have tested those instructions on a MAC before, and they worked at the time.
At the time, the procedure was the same as for the Windows PC. That’s why we only have those instructions. Maybe something has changed—I’ll need to check.
Just to be sure, did you follow the instructions on page 120? Were the commands running on the correct path?
I’m just trying to understand what might have gone wrong.
Regards,
Sara
Hi Sara
Yes to your question regarding correct path through to step 5 p122 to obtain the “Woohoo!”. I’ve just set up another directory called ‘VS Test’ and re-ran the instructions from your book as before. The same happens but this time I received the ‘Already logged in message…’ which is to be expected from my previous initial setup.
Then, from p123 step 1 i entered my ‘sudo firebase init’ command within the correct terminal directory. p123 step 3 is displayed and I answer as per your book. Refer output below for the remaining output. Step 8 p125 does not show any files in my ‘VS Test’ project folder. From here I copied the files manually into my project folder as per my previous comments to get past this issue. All goes well after that. I’m also using the latest version of VS Code as comments above.
—————–
xxxx@Peters-MacBook-Air-84 VS Test % sudo firebase login
Password:
Already logged in as xxxx@gmail.com
xxxx@Peters-MacBook-Air-84 VS Test % sudo firebase init
Password:
*** FIREBASE LOGO APPEARS HERE ***
You’re about to initialize a Firebase project in this directory:
/Users/xxxx (not showing my actual folder name, xxxx blanked)
Before we get started, keep in mind:
* You are initializing within an existing Firebase project directory
? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confirm your choices. Realtime Database: Configure a security rules file for Realtime Database and (optionally)
provision default instance, Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys
=== 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.
i .firebaserc already has a default project, using peter-iot-app.
=== Database Setup
i database: ensuring required API firebasedatabase.googleapis.com is enabled…
✔ database: required API firebasedatabase.googleapis.com is enabled
Firebase Realtime Database Security Rules allow you to define how your data should be
structured and when your data can be read from and written to.
✔ Database Rules for peter-iot-app-default-rtdb have been written to database.rules.json.
Future modifications to database.rules.json will update Realtime Database Security Rules when you run
firebase deploy.
=== 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? y
? Configure as a single-page app (rewrite all urls to /index.html)? No
? Set up automatic builds and deploys with GitHub? No
✔ Wrote y/404.html
✔ Wrote y/index.html
i Writing configuration info to firebase.json…
i Writing project information to .firebaserc…
✔ Firebase initialization complete!
xxxx@Peters-MacBook-Air-84 VS Test %
Hi Peter.
Thanks for your answer.
Tomorrow I’ll try it again with the MAC computer and see what I get and update things if needed.
Thank you for your patience.
Regards
Sara
Thanks Sarah – you’ll notice that i did not want to use my public folder for this test. It wrote to the y directory and the 404 and index files expectably went there as it had previously done so for public. A great book by the way. Cheers