dataform-co/dataform

Dataform encountered an error: "length" is outside of buffer bounds - Node v22.7.0

Opened this issue · 2 comments

Upgraded to NodeJS v22.7.0 and experienced the following error:

Node v22.7.0 (npm 10.8.2) /opt/homebrew/Cellar/node/22.7.0/bin/node
benjaminwestern@macbook-pro ~/c/n/dataform (main)> dataform compile                                                           (base)
Compiling...

(node:59555) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Dataform encountered an error: "length" is outside of buffer bounds
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] (/opt/homebrew/lib/node_modules/@dataform/cli/node_modules/protobufjs/src/writer_buffer.js:61:13)
    at BufferWriter.finish (/opt/homebrew/lib/node_modules/@dataform/cli/node_modules/protobufjs/src/writer.js:453:14)
    at encode64 (/opt/homebrew/lib/node_modules/@dataform/cli/worker_bundle.js:33:63)
    at createCoreExecutionRequest (/opt/homebrew/lib/node_modules/@dataform/cli/worker_bundle.js:27400:12)
    at compile (/opt/homebrew/lib/node_modules/@dataform/cli/worker_bundle.js:27378:69)
    at process.<anonymous> (/opt/homebrew/lib/node_modules/@dataform/cli/worker_bundle.js:27383:36)
    at process.emit (node:events:532:35)
    at emit (node:internal/child_process:951:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:91:21)

Using NVM and switching to v22.6.0 resolves the issue:

Now using Node v22.6.0 (npm 10.8.2) ~/.local/share/nvm/v22.6.0/bin/node
benjaminwestern@macbook-pro ~/c/n/dataform (main)> dataform compile                                                           (base)
Compiling...

(node:59605) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Compiled 34 action(s).

Error Occurs with:
Current Node Version on System:

benjaminwestern@macbook-pro ~/c/n/dataform (main)> node -v                                                                    (base)
v22.7.0

Current NPM Version on System:

benjaminwestern@macbook-pro ~/c/n/dataform (main)> npm -v                                                                     (base)
10.8.2

Node installed with Homebrew (before using NVM):

benjaminwestern@macbook-pro ~/c/n/dataform (main)> which node                                                                 (base)
/opt/homebrew/bin/node

Dataform Version:

benjaminwestern@macbook-pro ~/c/n/dataform (main) [1]> dataform --version                                                     (base)
3.0.2

Let me know if you require any more information!

Cheers

Interesting, this looks like a ProtobufJS bug! It's not too surprising, given that we use a slightly older version.

I would recommend using the LTS node version v20.17.0 rather than v22.7.0, and see if it still happens.

Thanks @Ekrekr works great on v20.17.0 and v22.6.0 :)