protobuf.js
protobuf.js copied to clipboard
"length" is outside of buffer bounds
protobuf.js version: 7.4.0
It appears that the latest nodejs version (22.7.0) triggers this error:
RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: "length" is outside of buffer bounds
at
I have the same error
We are observing same issue
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] (/app/node_modules/.pnpm/[email protected]/node_modules/protobufjs/src/writer_buffer.js:61:13)
at BufferWriter.finish (/app/node_modules/.pnpm/[email protected]/node_modules/protobufjs/src/writer.js:453:14)
at /app/node_modules/.pnpm/@[email protected]/node_modules/@grpc/proto-loader/build/src/index.js:152:109
at Array.map (<anonymous>)
at createPackageDefinition (/app/node_modules/.pnpm/@[email protected]/node_modules/@grpc/proto-loader/build/src/index.js:152:39)
at Object.fromJSON (/app/node_modules/.pnpm/@[email protected]/node_modules/@grpc/proto-loader/build/src/index.js:205:12)
at GrpcClient.loadProtoJSON (/app/node_modules/.pnpm/[email protected][email protected]/node_modules/google-gax/build/src/grpc.js:228:51)
at new TranslationServiceClient (/app/node_modules/.pnpm/@[email protected][email protected]/node_modules/@google-cloud/translate/build/src/v3/translation_service_client.js:146:38)
at new GoogleTranslationService (/app/apps/dist/lib/google-translation.js:55:32)
As a fix, we decided to downgrade node version (22.4.0 works fine).
Same issue, not necessary to [email protected]. The error thrown on my 7.3.3
This sounds like an upstream Node issue:
- https://github.com/nodejs/node/issues/54518
- https://github.com/nodejs/node/pull/54524#issuecomment-2307438395
In case you are still experiencing that issues, try these LTS versions:
- v20.17.0 (april '26)
- v18.20.4 (april '25)
Everything above looks from my perspective broken and leads to these buffer errors.
Also fixed in the latest node (v22.8.0)
@mbrevda thanks, upgrading to v22.8.0 worked for me
Faced same "length" is outside of buffer bounds error even with node v23.3.0
Had to downgrade to node v20.18.1 and now it works perfectly fine.
The issue still persists. Please take a look, this should be reopened.
Works with v22.8.0 but not with v23.8.0