Repository navigation
Description
Please make sure you have searched for information in the following guides.
- Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
- Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
- Check our Troubleshooting guide: https://github.com/googleapis/google-cloud-node/blob/main/docs/troubleshooting.md
- Check our FAQ: https://github.com/googleapis/google-cloud-node/blob/main/docs/faq.md
- Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md
- Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs
- Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples
- Check the API's issue tracker: https://cloud.google.com/support/docs/issue-trackers
Library Name
@google-cloud/storage (9.0.0)
A screenshot that you have tested with "Try this API".
Not applicable: this is a client library bug, not an API bug. The JSON API's objects.delete works correctly; the library adds unintended query parameters to the request URL. GCS currently ignores them, so the delete still succeeds.
Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.
A step-by-step description of how to reproduce the issue, based on the linked reproduction.
Install @google-cloud/storage 9.0.0 and call:
await storage.bucket('my-bucket').file('some-object').delete({ ignoreNotFound: true });
Then log the outgoing request URL (for example by wrapping https.request). The DELETE is sent as .../o/some-object?responseType=text&validateStatus=(status)%20%3D%3E%20%7B... with the JavaScript source of a function in the query string.
Cause: in build/cjs/src/file.js, File.delete builds reqOpts = { ...options, responseType: 'text', validateStatus } and calls super.delete(reqOpts). ServiceObject.delete in build/cjs/src/nodejs-common/service-object.js then spreads all of its options into queryParameters, so the two transport options end up in the URL.
Version 8.4.0 sends the same DELETE with no extra query parameters.
A clear and concise description of what the bug is, and what you expected to happen.
responseType and validateStatus are applied as request (transport) options and are not sent as query parameters, as in 8.4.0. Observed today against real GCS: the delete succeeds and ignoreNotFound still works, because the server ignores the unknown parameters.
A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **
These are client-side options for the HTTP transport (gaxios), not JSON API parameters. Sending them leaks a function's source code into every delete URL and server request log, and the request depends on the server continuing to ignore unknown parameters. It looks like a regression from the 9.0.0 move from teeny-request to gaxios.
Activity
fix(storage): stop leaking transport options in File.delete() URL