Hi, I started getting the following error all of a sudden.
I have google speech client, but made no changes to it. Didn’t install any new libraries. Works locally.
Please take a look. Thank you
==> Starting service…
Aug 25 07:24:02 PMRangeError: “length” is outside of buffer bounds
Aug 25 07:24:02 PM at Buffer.proto.utf8Write (node:internal/buffer:1066:13)
Aug 25 07:24:02 PM at Op.writeStringBuffer [as fn] (/app/backend/node_modules/protobufjs/src/writer_buffer.js:61:13)
Aug 25 07:24:02 PM at BufferWriter.finish (/app/backend/node_modules/protobufjs/src/writer.js:453:14)
Aug 25 07:24:02 PM at /app/backend/node_modules/@grpc/proto-loader/src/index.ts:382:62
Aug 25 07:24:02 PM at Array.map ()
Aug 25 07:24:02 PM at createPackageDefinition (/app/backend/node_modules/@grpc/proto-loader/src/index.ts:381:47)
Aug 25 07:24:02 PM at Object.fromJSON (/app/backend/node_modules/@grpc/proto-loader/src/index.ts:453:10)
Aug 25 07:24:02 PM at GrpcClient.loadProtoJSON (/app/backend/node_modules/google-gax/build/src/grpc.js:228:51)
Aug 25 07:24:02 PM at new SpeechClient (/app/backend/node_modules/@google-cloud/speech/build/src/v1/speech_client.js:147:38)
Aug 25 07:24:02 PM at Object. (/app/backend/dist/rest/services/speechToText.service.js:117:22) {
Aug 25 07:24:02 PM code: ‘ERR_BUFFER_OUT_OF_BOUNDS’
Aug 25 07:24:02 PM}
Hey,
This isn’t an error with Render; it’s an error coming from your application, which we can’t control. What have you tried so far to troubleshoot it? It looks like it could be a simple coding mistake.
Jérémy.
Render Support, UTC+3
I have run into the same issue. I simply redeployed the same codebase on the same server where it was working a few minutes ago. Now it throws this error
I managed to fix it by setting the node version to 22.4.0
It seems like there is a problem with the newest version of node and some packages.
See here:
opened 08:12AM - 23 Aug 24 UTC
closed 08:48AM - 27 Aug 24 UTC
confirmed-bug
buffer
regression
v22.x
### Version
22.7.0
### Platform
```text
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_
opened 06:21AM - 23 Aug 24 UTC
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](https://github.com/user-attachments/assets/15d0f50e-bab0-4fbc-b506-b106fb3d43a4)
Thanks Jakob. Yes, seems to be an issue with the node updates. I fixed it by downgrading to node version 20 which has LTS (long term support). 21 and 22 is still considered not production-ready so it might be best to avoid until they have LTS. Any updates there can silently break the app while building.