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] RangeError thrown on Node version 22.7.0 #2688

Closed
vladmashk opened this issue Aug 27, 2024 · 6 comments
Closed

[Firestore] RangeError thrown on Node version 22.7.0 #2688

vladmashk opened this issue Aug 27, 2024 · 6 comments

Comments

@vladmashk
Copy link

  • Operating System version: Windows 11, macOS Sonoma 14.6.1
  • Firebase SDK version: [email protected]
  • Firebase Product: Firestore
  • Node.js version: 22.7.0
  • NPM version: 10.8.2

Description of the problem

Accessing the firestore API throws a RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: "length" is outside of buffer bounds

Steps to reproduce:

Any access like:
const snapshot = await db.collection("...").get(); for example
throws this error.

This problem didn't happen on Node 22.4.0.

Stack trace

RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: "length" is outside of buffer bounds
    at proto.utf8Write (node:internal/buffer:1066:13)
    at Op.writeStringBuffer [as fn] (C:\path\to\package\node_modules\protobufjs\src\writer_buffer.js:61:13)
    at BufferWriter.finish (C:\path\to\package\node_modules\protobufjs\src\writer.js:453:14)
    at C:\path\to\package\node_modules\@grpc\proto-loader\build\src\index.js:177:109
    at Array.map (<anonymous>)
    at createPackageDefinition (C:\path\to\package\node_modules\@grpc\proto-loader\build\src\index.js:177:39)
    at Object.fromJSON (C:\path\to\package\node_modules\@grpc\proto-loader\build\src\index.js:230:12)
    at GrpcClient.loadProtoJSON (C:\path\to\package\node_modules\google-gax\build\src\grpc.js:228:51)
    at new LocationsClient (C:\path\to\package\node_modules\google-gax\build\src\locationService.js:118:32)
    at new FirestoreClient (C:\path\to\package\node_modules\@google-cloud\firestore\build\src\v1\firestore_client.js:136:32)
Caused by: Error
    at QueryUtil._getResponse (C:\path\to\package\node_modules\@google-cloud\firestore\build\src\reference\query-util.js:42:23)
    at CollectionReference._getResponse (C:\path\to\package\node_modules\@google-cloud\firestore\build\src\reference\query.js:792:32)
    at CollectionReference._get (C:\path\to\package\node_modules\@google-cloud\firestore\build\src\reference\query.js:785:35)
    at CollectionReference.get (C:\path\to\package\node_modules\@google-cloud\firestore\build\src\reference\query.js:754:39)
    at <my code>
@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@vladmashk
Copy link
Author

The problem also doesn't happen on Node 22.6.0

@dancamdev
Copy link

This might be happening in bun as well, where db.collection("...").get(); returns an inconsistent number of docs whenever it's run.

@anasmohammed361
Copy link

anasmohammed361 commented Aug 28, 2024

downgrading to node v20 fixed the issue

@lahirumaramba
Copy link
Member

lahirumaramba commented Aug 30, 2024

Hey folks, this is due to a bug in Node v22.7.0
nodejs/node#54518

It should be fixed in v22.8.0, which they plan to release next week nodejs/node#54560 (comment)

I am closing this issue since this does not require any changes to the SDK.

@ExpertzZ
Copy link

Hey folks, this is due to a bug in Node v22.7.0 nodejs/node#54518

It should be fixed in v22.8.0, which they plan to release next week nodejs/node#54560 (comment)

I am closing this issue since this does not require any changes to the SDK.

wow thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants
@lahirumaramba @google-oss-bot @dancamdev @vladmashk @ExpertzZ @anasmohammed361 and others