nodejs-storage: Latest release is causing uploads to fail with "GaxiosError: Required"
Since upgrading @google-cloud/storage to 5.14.2, uploads created with File.createWriteStream()
have started failing with the fairly cryptic error mentioned in the title. It seems like some value isn’t being sent to the server, but there’s no indication of what that is. No other aspect of the code, the environment, or the bucket configuration has changed.
Here’s the full error output. Let me know if any other information would be helpful:
GaxiosError: Required
at Gaxios._request (/image/node_modules/gaxios/build/src/gaxios.js:129:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async JWT.requestAsync (/image/node_modules/google-auth-library/build/src/auth/oauth2client.js:368:18)
at async Upload.makeRequest (/image/node_modules/gcs-resumable-upload/build/src/index.js:348:21)
at async Upload.createURIAsync (/image/node_modules/gcs-resumable-upload/build/src/index.js:171:22) {
response: {
config: {
method: 'POST',
url: 'https://storage.googleapis.com/upload/storage/v1/b/(redacted)/o?name=sanitized%2Fg2planet-emax-master.pg&uploadType=resumable',
params: [Object],
data: [Object],
headers: [Object],
validateStatus: [Function (anonymous)],
paramsSerializer: [Function: paramsSerializer],
body: '{"storageClass":"multi_regional"}',
responseType: 'json'
},
data: { error: [Object] },
headers: {
'cache-control': 'no-cache, no-store, max-age=0, must-revalidate',
connection: 'close',
'content-length': '191',
'content-type': 'application/json; charset=UTF-8',
date: 'Tue, 21 Sep 2021 13:52:55 GMT',
expires: 'Mon, 01 Jan 1990 00:00:00 GMT',
pragma: 'no-cache',
server: 'UploadServer',
vary: 'Origin, X-Origin',
'x-guploader-uploadid': 'ADPycduORZSKta7Z16dQ01vYRwJpaqOz9zWLYl_HUVvDr4S_RLAL34IMUywSH0gPFqaAb3-KE2HnesZAmhOnX8skfKI'
},
status: 400,
statusText: 'Bad Request',
request: {
responseURL: 'https://storage.googleapis.com/upload/storage/v1/b/(redacted)/o?name=sanitized%2Fg2planet-emax-master.pg&uploadType=resumable'
}
},
config: {
method: 'POST',
url: 'https://storage.googleapis.com/upload/storage/v1/b/(redacted)/o?name=sanitized%2Fg2planet-emax-master.pg&uploadType=resumable',
params: {
name: 'sanitized/g2planet-emax-master.pg',
uploadType: 'resumable'
},
data: { storageClass: 'multi_regional' },
headers: {
Authorization: 'Bearer (redacted)',
'User-Agent': 'google-api-nodejs-client/7.9.2',
'x-goog-api-client': 'gl-node/16.9.1 auth/7.9.2',
'Content-Type': 'application/json',
Accept: 'application/json'
},
validateStatus: [Function (anonymous)],
paramsSerializer: [Function: paramsSerializer],
body: '{"storageClass":"multi_regional"}',
responseType: 'json'
},
code: 400,
errors: [ { message: 'Required', domain: 'global', reason: 'required' } ]
}
Environment details
- OS: Debian 10 (Official Node.js Docker image)
- Node.js version: 16.9.1
- npm version: 7.21.1
@google-cloud/storage
version:
Steps to reproduce
- Create an upload stream with File.createWriteStream() and attempt to write to it
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 18 (8 by maintainers)
UPDATE: The node-fetch package was defaulting to version 2.6.3 for me, which was the source of the issue (as outlined by several of the references made in comments above). I was able to get it working by adding the following as “dependencies” under both gaxios and teeny-request in my package-lock.json:
And then running
npm install
to update the packages accordingly.@jeremydw I totally agree that the message could be improved / more details given. We have some upcoming initiatives to improve error messaging in the storage library as well as some of the dependencies. This will hopefully improve clarity in the future.
For me:
5.7.0
, not5.14.2