RangeError: "length" is outside of buffer bounds

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:

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.