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:
- Backend: Node.js
- Firestore Client Library: @Google -cloud/firestore (inferred from error source)
- Project ID: wimade-it-455416
- Database Instance: (default)
- Document Path: custConfigChat/test
Problem Description:
- My Node.js backend code uses the @Google -cloud/firestore library to fetch the document at path custConfigChat/test from the (default) database.
- This operation fails, and the following error is logged, indicating a NOT_FOUND status code from the underlying gRPC call:
Error: 5 NOT_FOUND:
at callErrorFromStatus (/app/node_modules/@grpc/grpc-js/build/src/call.js:32:19) - I have logged into the Firebase/GCP Console for project wimade-it-455416. From the Console’s Firestore viewer, selecting the (default) database, I can navigate to the custConfigChat collection and see the document with the exact ID test. I can open it and view its contents.
Checks Performed:
- I have carefully verified the Project ID (wimade-it-455416), database instance ((default)), collection name (custConfigChat), and document ID (test) used in my Node.js code, ensuring they exactly match what’s shown in the console (including case sensitivity).
- My application authenticates using standard methods (likely Application Default Credentials or a Service Account key loaded via GOOGLE_APPLICATION_CREDENTIALS).
- I have also verified the IAM roles assigned to the service account (or principal) executing this code. It appears to have the necessary Firestore permissions (e.g., the ‘Cloud Datastore User’ role).
- I have also confirmed that the required APIs (specifically the Cloud Firestore API) are enabled in the Google Cloud project (wimade-it-455416).
- I confirmed the document path is correct (it’s a top-level collection custConfigChat containing the document test within the default database).
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:
- Subtle permission issues specific to the API call / authentication context that aren’t covered by standard IAM roles or are perhaps overridden by complex Security Rules (although NOT_FOUND seems less likely for rule denials)?
- Issues related to Firestore database regions or potential (though unlikely for reads) data consistency delays?
- Any known quirks or specific configuration requirements for the @Google -cloud/firestore library when running in my environment that might lead to this, especially concerning the default database?
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!