I think you should mention that in Test mode it allows anyone to read/write to your database, and you can change that to Locked mode or Auth required to secure it.
Yoo! I got an issue where i can't seem to upload anything to the firestore from the static site when it's built, but it works perfectly in develop mode. Researched a bit and got to understand that it's because we're using Webpack's dev server but not in the build, how do i work around this? Great content btw
Glad you're liking what I'm putting out! Do you have a repository I could take a look at? What's the error message you're getting? What tech are you using to build your website? Are you using environment variables for your Firestore keys, and if so, are they being injected properly? What are you Firestore rules? I know it's a ton of questions 😅 but instead of solving it in the RUclips comments head over to my Discord where I can help you out more effectively! bradgarropy.com/discord
@@bradgarropy firebase requires node. if you're running in dev its run in the node env. Gatsby in production isn't node and therefore a request for node-fetch doesn't exist. so it fails unless you do extra work for gatsby ssr
You are correct that a production Gatsby build doesn't run node, it generates static files. However, Firestore is definitely supported from the client! This library from Google implements the client side Firebase SDK. github.com/firebase/firebase-js-sdk Even in their docs they describe it as both a client and server side implementation: "Use our flexible, scalable NoSQL cloud database to store and sync data for client- and server-side development." You are most likely attempting to run the web client SDK code during the build process. Be sure to only run the web client SDK from the browser, and not during the build process. You can do this by wrapping calls to Firestore in a useEffect, or checking if the window object exists before running the SDK.
I think you should mention that in Test mode it allows anyone to read/write to your database, and you can change that to Locked mode or Auth required to secure it.
I'll do a dedicated video on Firestore rules in the future that will dive into this much deeper!
Yoo! I got an issue where i can't seem to upload anything to the firestore from the static site when it's built, but it works perfectly in develop mode. Researched a bit and got to understand that it's because we're using Webpack's dev server but not in the build, how do i work around this? Great content btw
Glad you're liking what I'm putting out!
Do you have a repository I could take a look at? What's the error message you're getting? What tech are you using to build your website? Are you using environment variables for your Firestore keys, and if so, are they being injected properly? What are you Firestore rules?
I know it's a ton of questions 😅 but instead of solving it in the RUclips comments head over to my Discord where I can help you out more effectively!
bradgarropy.com/discord
yeah this runs in develop, but good luck getting it to run in production. building the project will fail in this example.
Can you provide a reproduction? What error message are you getting?
@@bradgarropy firebase requires node. if you're running in dev its run in the node env. Gatsby in production isn't node and therefore a request for node-fetch doesn't exist. so it fails unless you do extra work for gatsby ssr
You are correct that a production Gatsby build doesn't run node, it generates static files. However, Firestore is definitely supported from the client!
This library from Google implements the client side Firebase SDK.
github.com/firebase/firebase-js-sdk
Even in their docs they describe it as both a client and server side implementation:
"Use our flexible, scalable NoSQL cloud database to store and sync data for client- and server-side development."
You are most likely attempting to run the web client SDK code during the build process. Be sure to only run the web client SDK from the browser, and not during the build process. You can do this by wrapping calls to Firestore in a useEffect, or checking if the window object exists before running the SDK.
@@bradgarropy thanks for the follow up advice and link! i might have to revisit an old project i gave up on now. you're the best!