ERR_BUFFER_OUT_OF_BOUNDS error with Google Vision package on Node 22.7.0 #54518
Closed
Description
Version
22.7.0
Platform
Darwin Sebastian-MacBook-Pro.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64
Subsystem
No response
What steps will reproduce the bug?
Create a file called test.js with the following content.
Add the @google-cloud/vision
package to your package.json and run npm install
.
const vision = require('@google-cloud/vision');
// Set up your Google Cloud Vision client
const client = new vision.ImageAnnotatorClient({
keyFilename: 'XXX.json'
});
Start via node test.js
How often does it reproduce? Is there a required condition?
On each NodeJS start
What is the expected behavior? Why is that the expected behavior?
It should not crash.
The same code starts with version 22.5.0, here is the output:
node test.js
(node:34273) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
What do you see instead?
node:internal/buffer:1066
throw new ERR_BUFFER_OUT_OF_BOUNDS('length');
^
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] (/Users/sebastianscheibe/Code/XXX/node_modules/protobufjs/src/writer_buffer.js:61:13)
at BufferWriter.finish (/Users/sebastianscheibe/Code/XXX/node_modules/protobufjs/src/writer.js:453:14)
at /Users/sebastianscheibe/Code/XXX/node_modules/@grpc/proto-loader/build/src/index.js:177:109
at Array.map (<anonymous>)
at createPackageDefinition (/Users/sebastianscheibe/Code/XXX/node_modules/@grpc/proto-loader/build/src/index.js:177:39)
at Object.fromJSON (/Users/sebastianscheibe/Code/XXX/node_modules/@grpc/proto-loader/build/src/index.js:230:12)
at GrpcClient.loadProtoJSON (/Users/sebastianscheibe/Code/XXX/node_modules/google-gax/build/src/grpc.js:228:51)
at new ImageAnnotatorClient (/Users/sebastianscheibe/Code/XXX/node_modules/@google-cloud/vision/build/src/v1/image_annotator_client.js:148:38)
at Object.<anonymous> (/Users/sebastianscheibe/Code/XXX/test.js:5:16) {
code: 'ERR_BUFFER_OUT_OF_BOUNDS'
}
Node.js v22.7.0
Additional information
No response
Activity