storage 9.0.0: a custom apiEndpoint always authenticates now (useAuthWithCustomEndpoint is ignored), so emulators need credentials
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 72/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- node.js, typescript
- Bereich
- authentication, backend
Rechercherichtung
Start in handwritten/storage and trace how Storage passes apiEndpoint and useAuthWithCustomEndpoint into StorageTransport. Read StorageTransport.makeRequest alongside resumable-upload.js, which the issue says still handles custom endpoints without authentication. Reproduce with fake-gcs-server and verify that JSON API calls work without credentials when the option is false, while authentication is used when it is true.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Package: @google-cloud/storage (handwritten/storage)
Environment
@google-cloud/storage9.0.0 (gaxios 8.3.3, google-auth-library 11.3.4)- Node 22.23.4 (same under Bun 1.4.4)
- No Google credentials in the environment: no
GOOGLE_APPLICATION_CREDENTIALS, no gcloud ADC, not on GCP
Steps to reproduce
Against fake-gcs-server (docker run -p 4443:4443 fsouza/fake-gcs-server -scheme http -backend memory):
import { Storage } from "@google-cloud/storage";
for (const opts of [{}, { useAuthWithCustomEndpoint: false }]) {
const storage = new Storage({ projectId: "p", apiEndpoint: "http://127.0.0.1:4443", ...opts });
try {
const [exists] = await storage.bucket("repro-bucket").file("missing.txt").exists();
console.log(opts, "exists() answered", exists);
} catch (e) {
console.log(opts, e.message);
}
}
Actual (9.0.0)
{} Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
{ useAuthWithCustomEndpoint: false } Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
The same happens for every JSON API call (getMetadata, download, createReadStream, copy, delete, getFiles, save with resumable: false). Resumable uploads still work without credentials.
Expected (8.4.0)
{} exists() answered false
{ useAuthWithCustomEndpoint: false } exists() answered false
A custom endpoint is not authenticated unless useAuthWithCustomEndpoint is true, which is still what the option's JSDoc says in 9.0.0 ("Controls whether or not to use authentication when using a custom endpoint", default false).
Cause
Storage still sets customEndpoint and passes useAuthWithCustomEndpoint to StorageTransport, which stores it but never reads it: makeRequest sends every request through this.authClient.request() (a GoogleAuth), so credentials are looked up whatever the endpoint. resumable-upload.js still checks useAuthWithCustomEndpoint and uses plain gaxios for a custom endpoint, which is why resumable uploads keep working. MIGRATION.md doesn't mention the change.
Workaround
new Storage({ apiEndpoint, authClient: new PassThroughClient() }), with PassThroughClient from google-auth-library.
Suggested fix
In StorageTransport.makeRequest, send the request without authentication when the endpoint is custom and useAuthWithCustomEndpoint is not true, as 8.x did (for example through the plain gaxios instance, as resumable-upload.js does).
- Vorherrschende Sprache
- TypeScript
- Sterne
- 3.2k
- Forks
- 732
- Ø Merge
- 2 T. 11 Std.
- Gemergte PRs (30 T.)
- 99
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus googleapis/google-cloud-node
-
Broken deprecation chainOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
googleapis/google-cloud-node#9854 ·
Maintainer antworten meist innerhalb von 1 Tag
-
pubsub: "Operation attempted on ended Span" when a modack is flushed after the message was ackedOffenapi: pubsub
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
googleapis/google-cloud-node#9853 ·
Maintainer antworten meist innerhalb von 1 Tag
-
storage: V4 getSignedUrl sorts canonical headers with localeCompare, so they disagree with X-Goog-SignedHeadersEvtl. vergeben @itsrayeedscodespace hat das vor 9 Tagen übernommen. Offenapi: storage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
googleapis/google-cloud-node#9840 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
firestore: getPartitions() emits gax AutopaginateTrueWarning in every processEvtl. vergeben @TheRealDanii hat das vor 12 Tagen übernommen. Offenapi: firestore
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
googleapis/google-cloud-node#9736 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
googleapis/google-cloud-node#9723 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in googleapis/google-cloud-node
Ähnliche Issues
-
Type/Improvement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
OpenNSW/nsw-srilanka#1259 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
oxc-project/tsrs#1010 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Fission-AI/OpenSpec#2260 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Add: ESP 1 UKOffencheck:passed streams:add
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 64/100
Maintainer antworten meist innerhalb von 1 Tag
-
area:infra area:storage bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
THU-MAIC/OpenMAIC#2311 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag