protobuf.js icon indicating copy to clipboard operation
protobuf.js copied to clipboard

"length" is outside of buffer bounds

Open phaistonian opened this issue 1 year ago • 4 comments

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

CleanShot 2024-08-23 at 09 21 15@2x

phaistonian avatar Aug 23 '24 06:08 phaistonian

I have the same error image

likezero avatar Aug 23 '24 07:08 likezero

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).

markkkkas avatar Aug 23 '24 08:08 markkkkas

Same issue, not necessary to [email protected]. The error thrown on my 7.3.3

cecilulysess avatar Aug 23 '24 09:08 cecilulysess

This sounds like an upstream Node issue:

  • https://github.com/nodejs/node/issues/54518
  • https://github.com/nodejs/node/pull/54524#issuecomment-2307438395

danielbankhead avatar Aug 23 '24 11:08 danielbankhead

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.

nextlevelshit avatar Sep 03 '24 10:09 nextlevelshit

Also fixed in the latest node (v22.8.0)

mbrevda avatar Sep 05 '24 10:09 mbrevda

@mbrevda thanks, upgrading to v22.8.0 worked for me

temirrr avatar Sep 10 '24 20:09 temirrr

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.

Ngufuli avatar Nov 30 '24 19:11 Ngufuli

The issue still persists. Please take a look, this should be reopened. Works with v22.8.0 but not with v23.8.0

StiliyanKushev avatar Feb 23 '25 14:02 StiliyanKushev