Hi everyone,
I'm facing a puzzling issue with Firestore. My Node.js backend application consistently receives a 5 NOT_FOUND error when trying to fetch a specific Firestore document, even though I can verify through the Firebase/GCP Console that the document definitely exists and is accessible there.
Environment:
Problem Description:
Checks Performed:
Question:
Given that the document /custConfigChat/test definitely exists in the (default) database, is accessible via the Console, the executing principal appears to have the correct IAM permissions, and the Cloud Firestore API is enabled, what could cause the Firestore API (via the Node.js client library) to return a 5 NOT_FOUND error?
I understand NOT_FOUND usually means the document doesn't exist at that path, but the Console access and these configuration checks seem to contradict this. Are there other potential reasons for this specific error code in this scenario, such as:
I'm looking for possible explanations beyond simple "document doesn't exist", typos in the path/ID, or obvious IAM/API enablement issues, as I believe I've ruled those out. Any insights into why the API interaction would differ from the Console view would be very helpful.
Thanks in advance!
Solved! Go to Solution.
@mcbsalceda
Thanks for sharing those suggestions — I really appreciate you taking the time to help out!
I had already seen that GitHub discussion and tried those steps, but unfortunately none of them solved my issue.
In my case, the root cause was that I initially went directly to the Firebase Console, where I was prompted to create a new project. Without realizing it, this placed Firebase in the wrong GCP project.
What eventually solved it was this:
After setting it up correctly under the intended project, everything worked as expected.
Hopefully this helps someone else facing a similar situation!
Let me know if you'd like more details on the setup path I used via GCP.
Again — thanks a lot for your input and the effort, it’s much appreciated! 🙏
Hi @dan1701,
I came across a similar issue in GitHub that could help resolve your problem. Here are a few suggestions from the discussion that you might want to try.:
@lahirumaramba: Did you enable Firestore from the Firebase console? I have seen this error before when Firestore is not properly set up from the console.
@sr5434: I was able to get the code working when I used the Firebase NPM package on the backend and created a web app in the firebase console.
@ugursirmen: @dconeybe Hello, I experienced this issue nowadays and I realized that I deleted '(default)' named database. If you have not this default, you cannot access another one, I know this is stupid but when I re-created a database with '(default)' name and use it, the error resolved 🙂 I hope this was helpful.
@tobyL05: I managed to solve this issue by adding my database id to getFirestore() like so getFirestore(<database_id>). I didn't realize/forgot that I set my own custom database id in the Firebase Console when I created my database nor did I realize that the database id was there on the console the whole time.
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.
@mcbsalceda
Thanks for sharing those suggestions — I really appreciate you taking the time to help out!
I had already seen that GitHub discussion and tried those steps, but unfortunately none of them solved my issue.
In my case, the root cause was that I initially went directly to the Firebase Console, where I was prompted to create a new project. Without realizing it, this placed Firebase in the wrong GCP project.
What eventually solved it was this:
After setting it up correctly under the intended project, everything worked as expected.
Hopefully this helps someone else facing a similar situation!
Let me know if you'd like more details on the setup path I used via GCP.
Again — thanks a lot for your input and the effort, it’s much appreciated! 🙏