storage 9.0.0: getFiles apiResponse is now the HTTP response, so the documented apiResponse.prefixes is undefined

Ouverte
#9,869 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
45/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
node.js, typescript
Domaine
api

Piste de recherche

Start in handwritten/storage, where Bucket#getFiles and the other listing methods pass the HTTP response through as apiResponse; the JSDoc in src/bucket.ts (compiled to build/cjs/src/bucket.js) and MIGRATION.md describe the old shape. Reproduce by listing a bucket with delimiter '/' and checking whether the body sits at apiResponse or apiResponse.data. Done means either the body is restored to apiResponse for these methods, or the JSDoc and MIGRATION.md state that body fields are under apiResponse.data. The maintainers have not chosen between the two, so confirm the direction before writing code.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Package: @google-cloud/storage (handwritten/storage)

Environment

  • @google-cloud/storage 9.0.0 (gaxios 8.3.3, google-auth-library 11.3.4)
  • Node 26.5.1
  • Works as documented with 8.0.0, same code

Steps to reproduce

A bucket with at least one object under a "folder" (for example a/b.txt):

import { Storage } from "@google-cloud/storage";
const bucket = new Storage().bucket("<bucket>");
const [files, nextQuery, apiResponse] = await bucket.getFiles({ delimiter: "/", autoPaginate: false, maxResults: 1 });
console.log(Object.keys(apiResponse), apiResponse.prefixes, apiResponse.nextPageToken);

Actual (9.0.0)

apiResponse is the HTTP response object, and the JSON body is one level down:

[ 'size', 'data', 'config' ] undefined undefined

apiResponse.data has kind, nextPageToken and prefixes.

Expected (8.0.0, and what 9.0.0 still documents)

apiResponse is the JSON body:

[ 'kind', 'nextPageToken', 'prefixes' ] [ 'a/' ] '...'

The JSDoc shipped in 9.0.0 still describes the old shape: the Bucket#getFiles example reads apiResponse.prefixes, and the delimiter option says results are "returned in apiResponse.prefixes" (build/cjs/src/bucket.js).

Impact

Code that follows the documented way to list folders gets undefined for prefixes and nextPageToken after upgrading. Nothing throws, and apiResponse is typed unknown, so type checks do not catch it: folder listings silently come back empty and manual paging stops after the first page.

MIGRATION.md covers apiResponse.headers becoming a Headers object, but does not say that the body moved from apiResponse to apiResponse.data. The same change appears to apply to the other methods that now pass the response through (Storage#getBuckets, Storage#getHmacKeys, Bucket#getNotifications, File#copy, ...).

Request

Either pass the body as apiResponse again for these methods, or keep the new shape and update the JSDoc and MIGRATION.md to say that body fields are now under apiResponse.data.

Langage dominant
TypeScript
Étoiles
3.2k
Forks
732
Merge moyen
2 j 11 h
PR mergées (30 j)
99

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de googleapis/google-cloud-node

Toutes les issues de googleapis/google-cloud-node

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.