Skip to content

Downloading file fails when running on Node version 20.11.0 'Iron' (LTS) #2391

@nadavzipo

Description

@nadavzipo

Description

After upgrading Node to version 20.11.0, running await bucket.file(fileLink).download(); throw the following error -

 error: TypeError: Cannot read properties of null (reading 'length')
      at getStateLength (/Users/nadavnagel/Documents/dev/zipoapps/integrations-service/node_modules/stream-shift/index.js:16:28)
      at shift (/Users/nadavnagel/Documents/dev/zipoapps/integrations-service/node_modules/stream-shift/index.js:6:99)
      at Duplexify._forward (/Users/nadavnagel/Documents/dev/zipoapps/integrations-service/node_modules/duplexify/index.js:170:35)
      at PassThrough.onreadable (/Users/nadavnagel/Documents/dev/zipoapps/integrations-service/node_modules/duplexify/index.js:136:10)
      at PassThrough.emit (node:events:518:28)
      at emitReadable_ (node:internal/streams/readable:832:12)
      at process.processTicksAndRejections (node:internal/process/task_queues:81:21),

The error isn't caught by the function try/catch and only by .on('uncaughtException', handler.

The error also happens when trying to create readable stream.

I think the issue happens because of node change of handling streams - nodejs/node#50341

Environment details

  • OS:
  • Node.js version: 20.11.0
  • npm version:
  • @google-cloud/storage version: 7.7.0

Steps to reproduce

  1. Upgrade to node version 20.11.0
  2. Try to execute await bucket.file(fileLink).download(); on any file.

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the googleapis/nodejs-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions