googleapis / nodejs-common

🚀🐢 A set of classes and utilities used in Google npm modules.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nodejs-storage system test fails with 0.18

kjin opened this issue · comments

It fails with 0.18.4 but the issue might have been introduced earlier, I haven't bisected the exact place when it breaks. Doesn't seem to break with 0.17.

Environment details

  • OS: macOS
  • Node.js version: 8.11.1
  • npm version: 5
  • @google-cloud/common version: 0.18.4

Steps to reproduce

In the storage module:

  1. npm install @google-cloud/common@0.18.4
  2. npm run system-test

There are two three issues here:

(1)

gcs-resumable-upload@0.10.2 accepts an AuthClient, and calls authorizeRequest with a callback: https://github.com/stephenplusplus/gcs-resumable-upload/blob/v0.10.2/src/index.ts#L381

When upgrading to @google-cloud/common@0.18.6, the dependency on google-auto-auth is dropped in favor of google-auth-library (#114). However, the google-auth-library@1.4.0 version of authorizeRequest is now Promise-based and doesn't take a callback, so control is lost.

What this means is that when uploading @google-cloud/common to 0.18, upgrade gcs-resumable-upload to 0.11 at the same time.

(2)

Effective after 0.18.6

As @JustinBeckwith pointed out, res.body could be unparsed in this statement: https://github.com/googleapis/nodejs-common/blob/master/src/service.ts#L245

Some libraries relied on it being the parsed object. #139 should fix this.

(3)

Bucket#request's call signature doesn't match ServiceObject#request.

This promisifyAll promisifies Bucket#request, and Bucket extends ServiceObject:

https://github.com/googleapis/nodejs-storage/blob/master/src/bucket.js#L2423

This causes issues because Bucket#request is now "double-promisified".

To fix this, add ['request', 'request_'] to the list of exclusions in the link. (This is a stopgap measure and probably should be replaced with something more permanent.)