Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File.save fails with Node 18.13.0 #2133

Closed
buu700 opened this issue Jan 23, 2023 · 7 comments
Closed

File.save fails with Node 18.13.0 #2133

buu700 opened this issue Jan 23, 2023 · 7 comments
Assignees
Labels
api: storage Issues related to the googleapis/nodejs-storage API. external This issue is blocked on a bug with the actual product. needs more info This issue needs more information from the customer to proceed. priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@buu700
Copy link

buu700 commented Jan 23, 2023

Environment details

  • OS: Debian 11.6 aarch64
  • Node.js version: 18.13.0
  • npm version: 9.3.1
  • @google-cloud/storage version: 6.9.0

Steps to reproduce

With a basic happy path usage of the library:

import {Storage} from '@google-cloud/storage';
const storage = new Storage(...).bucket(...);
await storage.file(...).save(...);

After upgrading from Node 18.12.1, I'm now getting the following error:

TypeError: RequestInit: duplex option is required when sending a body.
    at Object.fetch (node:internal/deps/undici/undici:14062:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  config: {
    method: 'PUT',
    url: 'https://storage.googleapis.com/upload/storage/v1/b/[redacted]',
    headers: {
      'x-goog-api-client': 'gl-node/18.13.0 gccl/6.9.0 gccl-invocation-id/[redacted]',
      'Content-Range': 'bytes 0-*/*',
      Authorization: 'Bearer [redacted]',
      Accept: 'application/json'
    },
    body: <ref *1> Readable {
      _readableState: ReadableState {
        objectMode: false,
        highWaterMark: 16384,
        buffer: BufferList { head: null, tail: null, length: 0 },
        length: 0,
        pipes: [],
        flowing: false,
        ended: false,
        endEmitted: false,
        reading: true,
        constructed: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: true,
        resumeScheduled: false,
        errorEmitted: false,
        emitClose: true,
        autoDestroy: true,
        destroyed: false,
        errored: null,
        closed: false,
        closeEmitted: false,
        defaultEncoding: 'utf8',
        awaitDrainWriters: null,
        multiAwaitDrain: false,
        readingMore: false,
        dataEmitted: true,
        decoder: null,
        encoding: null,
        [Symbol(kPaused)]: null
      },
      _read: [AsyncFunction: read],
      _events: [Object: null prototype] {
        readable: [Function (anonymous)],
        end: [Function (anonymous)],
        finish: [Function (anonymous)],
        error: [Function (anonymous)],
        close: [Function (anonymous)]
      },
      _eventsCount: 5,
      _maxListeners: undefined,
      __zone_symbol__readablefalse: [
        ZoneTask {
          _zone: Zone {
            _parent: null,
            _name: '<root>',
            _properties: {},
            _zoneDelegate: [_ZoneDelegate]
          },
          runCount: 2,
          _zoneDelegates: [],
          _state: 'scheduled',
          type: 'eventTask',
          source: 'Readable.addListener:readable',
          data: undefined,
          scheduleFn: [Function: customScheduleNonGlobal],
          cancelFn: [Function: customCancelNonGlobal],
          callback: [Function: next],
          invoke: [Function (anonymous)],
          options: undefined,
          target: [Circular *1],
          capture: false,
          eventName: 'readable'
        }
      ],
      __zone_symbol__endfalse: [
        ZoneTask {
          _zone: Zone {
            _parent: null,
            _name: '<root>',
            _properties: {},
            _zoneDelegate: [_ZoneDelegate]
          },
          runCount: 0,
          _zoneDelegates: [],
          _state: 'scheduled',
          type: 'eventTask',
          source: 'Readable.addListener:end',
          data: undefined,
          scheduleFn: [Function: customScheduleNonGlobal],
          cancelFn: [Function: customCancelNonGlobal],
          callback: [Function: onend],
          invoke: [Function (anonymous)],
          options: undefined,
          target: [Circular *1],
          capture: false,
          eventName: 'end'
        }
      ],
      __zone_symbol__finishfalse: [
        ZoneTask {
          _zone: Zone {
            _parent: null,
            _name: '<root>',
            _properties: {},
            _zoneDelegate: [_ZoneDelegate]
          },
          runCount: 0,
          _zoneDelegates: [],
          _state: 'scheduled',
          type: 'eventTask',
          source: 'Readable.addListener:finish',
          data: undefined,
          scheduleFn: [Function: customScheduleNonGlobal],
          cancelFn: [Function: customCancelNonGlobal],
          callback: [Function: onfinish],
          invoke: [Function (anonymous)],
          options: undefined,
          target: [Circular *1],
          capture: false,
          eventName: 'finish'
        }
      ],
      __zone_symbol__errorfalse: [
        ZoneTask {
          _zone: Zone {
            _parent: null,
            _name: '<root>',
            _properties: {},
            _zoneDelegate: [_ZoneDelegate]
          },
          runCount: 0,
          _zoneDelegates: [],
          _state: 'scheduled',
          type: 'eventTask',
          source: 'Readable.addListener:error',
          data: undefined,
          scheduleFn: [Function: customScheduleNonGlobal],
          cancelFn: [Function: customCancelNonGlobal],
          callback: [Function: onerror],
          invoke: [Function (anonymous)],
          options: undefined,
          target: [Circular *1],
          capture: false,
          eventName: 'error'
        }
      ],
      __zone_symbol__closefalse: [
        ZoneTask {
          _zone: Zone {
            _parent: null,
            _name: '<root>',
            _properties: {},
            _zoneDelegate: [_ZoneDelegate]
          },
          runCount: 0,
          _zoneDelegates: [],
          _state: 'scheduled',
          type: 'eventTask',
          source: 'Readable.addListener:close',
          data: undefined,
          scheduleFn: [Function: customScheduleNonGlobal],
          cancelFn: [Function: customCancelNonGlobal],
          callback: [Function: onclose],
          invoke: [Function (anonymous)],
          options: undefined,
          target: [Circular *1],
          capture: false,
          eventName: 'close'
        }
      ],
      [Symbol(kCapture)]: false
    },
    signal: AbortSignal {},
    validateStatus: [Function (anonymous)],
    paramsSerializer: [Function: paramsSerializer],
    responseType: 'json'
  }
}

Related issue: nodejs/node#46323

Edit: Replaced the internal Node stack trace with a more relevant error message (context here).

@buu700 buu700 added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jan 23, 2023
@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/nodejs-storage API. label Jan 23, 2023
@shaffeeullah
Copy link
Contributor

Hi @buu700 ,

This looks like a Node bug based on the issue you filed in the node repo. Will wait for that to be resolved and see if this issue persists.

@shaffeeullah shaffeeullah added the external This issue is blocked on a bug with the actual product. label Jan 24, 2023
@buu700
Copy link
Author

buu700 commented Feb 20, 2023

A few notes:

@ddelgrosso1
Copy link
Contributor

@buu700 spent some time attempting to recreate this today without success. I tried with a few versions of Node >= 1.8.13.0. Are there any additional steps besides the ones in your original post? Could you provide an npm ls as well?

@ddelgrosso1 ddelgrosso1 added priority: p3 Desirable enhancement or fix. May not be included in next release. needs more info This issue needs more information from the customer to proceed. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. labels Apr 3, 2023
@ddelgrosso1
Copy link
Contributor

As I have not been able to recreate this with several versions of Node >= 18.13.0 I am going to close this. If more information on recreation steps is available, please feel free to reopen.

@alexdao3
Copy link

alexdao3 commented Jan 9, 2024

@ddelgrosso1 I am currently running into this issue with node 18.17.0. With npm ls, I get the following:

├── @google-cloud/storage@7.1.0
├── firebase-admin@11.5.0
├── firebase-functions@4.4.1
├── firebase@10.7.1

@ddelgrosso1
Copy link
Contributor

@alexdao3 if possible, can you either create a new issue or reopen this one with any info that might be helpful to repro the issue? Thanks!

@buu700
Copy link
Author

buu700 commented Jan 9, 2024

Ah, thanks @alexdao3, and sorry I missed your comment last year @ddelgrosso1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/nodejs-storage API. external This issue is blocked on a bug with the actual product. needs more info This issue needs more information from the customer to proceed. priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants