Skip to content
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 #2216

Open
4 tasks done
okwme opened this issue Oct 7, 2024 · 1 comment
Open
4 tasks done

Firestore Repeatedly Returning Error: 5 NOT_FOUND #2216

okwme opened this issue Oct 7, 2024 · 1 comment
Assignees
Labels
api: firestore Issues related to the googleapis/nodejs-firestore API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@okwme
Copy link

okwme commented Oct 7, 2024

I found support for this issue from the firebase library but the issue exists in this library as well.

cloud.google.com/support told me this was "related to code and implementation" and "falls outside the scope of GCP tech support" even though I have the Enhanced Support for $500 / mo.

The issue is that if you're not using a database with the default name you have to explicitly declare the databaseID when instantiating the Firestore object. These docs never mention that or display an example of a database with a custom ID. The example given:

const {Firestore} = require('@google-cloud/firestore');

// Create a new client
const firestore = new Firestore();

async function quickstart() {
  // Obtain a document reference.
  const document = firestore.doc('posts/intro-to-firestore');

  // Enter new data into the document.
  await document.set({
    title: 'Welcome to Firestore',
    body: 'Hello World',
  });
  console.log('Entered new data into the document');

  // Update an existing document.
  await document.update({
    body: 'My first Firestore app',
  });
  console.log('Updated an existing document');

  // Read the document.
  const doc = await document.get();
  console.log('Read the document');

  // Delete the document.
  await document.delete();
  console.log('Deleted the document');
}
quickstart();

will fail unless the custom database ID is added explicitly as so:

const firestore = new Firestore({
    databaseId: 'custom-name'
});

it's probably best if you add the projectId there explicitly as well:

const firestore = new Firestore({
    projectId: 'my-project',
    databaseId: 'custom-name'
});

The error message for trying to write to the database without an explicit ID is unhelpful:

Error: 5 NOT_FOUND:
    at callErrorFromStatus (/Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
    at Object.onReceiveStatus (/Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@grpc/grpc-js/build/src/client.js:193:76)
    at Object.onReceiveStatus (/Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:360:141)
    at Object.onReceiveStatus (/Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:323:181)
    at /Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@grpc/grpc-js/build/src/resolving-call.js:129:78
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
for call at
    at ServiceClientImpl.makeUnaryRequest (/Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@grpc/grpc-js/build/src/client.js:161:32)
    at ServiceClientImpl.<anonymous> (/Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)
    at /Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@google-cloud/firestore/build/src/v1/firestore_client.js:237:29
    at /Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/google-gax/build/src/normalCalls/timeout.js:44:16
    at repeat (/Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/google-gax/build/src/normalCalls/retries.js:82:25)
    at /Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/google-gax/build/src/normalCalls/retries.js:125:13
    at OngoingCallPromise.call (/Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/google-gax/build/src/call.js:67:27)
    at NormalApiCaller.call (/Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/google-gax/build/src/normalCalls/normalApiCaller.js:34:19)
    at /Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/google-gax/build/src/createApiCall.js:112:30
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Caused by: Error
    at _firestore._traceUtil.startActiveSpan (/Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@google-cloud/firestore/build/src/write-batch.js:438:27)
    at DisabledTraceUtil.startActiveSpan (/Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@google-cloud/firestore/build/src/telemetry/disabled-trace-util.js:16:16)
    at WriteBatch.commit (/Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@google-cloud/firestore/build/src/write-batch.js:436:43)
    at /Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@google-cloud/firestore/build/src/reference/document-reference.js:354:31
    at DisabledTraceUtil.startActiveSpan (/Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@google-cloud/firestore/build/src/telemetry/disabled-trace-util.js:16:16)
    at DocumentReference.set (/Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@google-cloud/firestore/build/src/reference/document-reference.js:346:43)
    at /Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/index.js:35:49
    at /Users/billy/GitHub/trifle-labs/mmorps-gcp/functions/node_modules/@google-cloud/functions-framework/build/src/function_wrappers.js:100:29
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
  code: 5,
  details: '',
  metadata: Metadata {
    internalRepr: Map(1) { 'x-debug-tracking-id' => [Array] },
    options: {}
  },
  note: 'Exception occurred in retry method that was not classified as transient'
}

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

  1. Is this a client library issue or a product issue?
    This is the client library for "@google-cloud/firestore" .

  2. Did someone already solve this?

  1. Do you have a support contract?
  • Please create an issue in the support console to ensure a timely response.

If the support paths suggested above still do not result in a resolution, please provide the following details.

Environment details

  • OS: macOS 14.6.1 (23G93)
  • Node.js version: v18.20.3
  • npm version: 10.7.0
  • @google-cloud/firestore version: 7.10.0

Steps to reproduce

  1. Make your first database with a custom name.
  2. write a doc to the collection as outlined above

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

@okwme okwme added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Oct 7, 2024
@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/nodejs-firestore API. label Oct 7, 2024
@tom-andersen tom-andersen added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Oct 8, 2024
@tom-andersen
Copy link
Contributor

I will inform the maintainers of documentation that we should include a named database example. https://cloud.google.com/nodejs/docs/reference/firestore/latest/firestore/firestore#examples

@tom-andersen tom-andersen added priority: p3 Desirable enhancement or fix. May not be included in next release. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. labels Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/nodejs-firestore API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants