-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firestore Repeatedly Returning Error: 5 NOT_FOUND #2563
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Did you enable Firestore from the Firebase console? I have seen this error before when Firestore is not properly set up from the console. |
When I create a firebase app instead of using a service account it works sometimes |
@lahirumaramba @sr5434 I have two projects, one for development and one for production, and I am initializing Firestore using a service account. The development project does not have this issue. However, when I set up the production project yesterday, the problem occurred. (BTW, the same problem occurs in the production project, even in the emulator environment.) We have confirmed that the correct service account for the project is being loaded. Here are the details: // package.json
{
"engines": {
"node": "18"
},
"dependencies": {
"firebase-admin": "^11.11.1",
"firebase-functions": "^5.0.1"
}
} // firebaseConfig.js
const admin = require("firebase-admin");
require("dotenv").config({ path: `.env.${process.env.NODE_ENV}` });
const serviceAccount = require(process.env.SERVICE_ACCOUNT_KEY);
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
});
console.log(serviceAccount);
const db = admin.firestore();
module.exports = { db }; I found the same information and wanted to share it for your reference: Thank you for reading! |
Additionally, I conducted further investigations and would like to report the findings for your reference. Firstly, regarding the Firestore activation, I was able to manually add data from the console screen, so I believe Firestore has been successfully activated. Next, I tried the recommended method from the official documentation as follows, but the error situation remains the same. const { getFirestore } = require("firebase-admin/firestore");
const { initializeApp } = require("firebase-admin/app");
const app = initializeApp();
console.log("initializeApp", app);
const db = getFirestore();
console.log("getFirestore", db);
module.exports = { db }; |
Did you follow the same steps to generate both service accounts and were they generated on the Firebase Console? |
Yes, I believe I followed the same steps. I created both of these projects at the same time about a month ago. I issued the service account key for the production project a few days ago. |
I'll take a look at this tomorrow. For now, do you have some log output showing the entire stack trace and error message that you could post? |
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. |
Is your problem solved? |
Yes |
The production project required a specified database ID. The issue is resolved. Thank you! |
[READ] Step 1: Are you in the right place?
Cloud Firestore support is provided by the
@google-cloud/firestore
library. Therefore the easiest and most efficient way to get Firestore issues resolved is by directly reporting them at the nodejs-firestore GitHub repo.If you still think the problem is related to the code in this repository, then read on.
file a Github issue.
with the firebase tag.
google group.
of the above categories, reach out to the personalized
Firebase support channel.
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
When I call the API Route, instead of creating a new user in Firestore, I get a vague "Error: 5 NOT_FOUND" error message with no additional details. I have used this code before in other projects and can confirm that it used to work.
Relevant Code:
The following is a NextJS API Route I used.
The text was updated successfully, but these errors were encountered: