From 8eeb59cbfb16d8f379f7aa4c6f11e53cebbd38a6 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Thu, 30 Jan 2025 10:58:24 -0500 Subject: [PATCH] fix(storage): remove duplicate routing header (#11534) Appendable writes were duplicating the x-goog-request-params header which caused issues server side. Remove this. For append writes we need to include appendable=true and an optional routing token in this header. --- storage/grpc_client.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/storage/grpc_client.go b/storage/grpc_client.go index 4bb3e28c89d0..35c5c9fb8b7d 100644 --- a/storage/grpc_client.go +++ b/storage/grpc_client.go @@ -1744,7 +1744,14 @@ func (c *grpcStorageClient) OpenWriter(params *openWriterParams, opts ...storage return err } - err = run(bucketContext(gw.ctx, gw.bucket), uploadBuff, gw.settings.retry, s.idempotent) + // Add routing headers to the context metadata for single-shot and resumable + // writes. Append writes need to set this at a lower level to pass the routing + // token. + bctx := gw.ctx + if !gw.append { + bctx = bucketContext(bctx, gw.bucket) + } + err = run(bctx, uploadBuff, gw.settings.retry, s.idempotent) if err != nil { return err }