forked from googleapis/google-cloud-node
-
Notifications
You must be signed in to change notification settings - Fork 0
docs: add gaxios and node 18 migration guide #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
thiyaguk09
wants to merge
162
commits into
storage-node-18
Choose a base branch
from
docs/gaxios-migration-guide
base: storage-node-18
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
162 commits
Select commit
Hold shift + click to select a range
a2cd00b
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 72c17d7
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 3b2a681
docs: add gaxios and node 18 migration guide
thiyaguk09 ea376ce
docs: add examples for passing options headers and URL resolution
thiyaguk09 8eb2d72
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 eacb087
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 49a2b5a
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 b1a228c
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 683b3f4
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 0c58a9a
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 51c3e81
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 b5c81a1
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 fe44861
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 197b249
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 7c3ee50
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 0a4f5ac
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 86f0fb7
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 ef7c4d4
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 e3288e3
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 dafce2e
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 3dd33a5
test: add bytes method to mock responses in acl and headers tests
thiyaguk09 eb547c4
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 1fba172
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 5ad4fef
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 fafab27
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 d4b912f
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 4f6f722
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 c5be999
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 c0a6220
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 0a2ebe9
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 4865c5d
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 747d276
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 0f2652b
test: add bytes method to mock Gaxios response in acl and headers tests
thiyaguk09 64b606d
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 a82723e
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 e366cc2
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 ffd2057
test: add bytes method to mock Gaxios response in acl and headers tests
thiyaguk09 9fcdde2
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 8a0e737
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 4f69ca3
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 2d55123
test: add bytes method to mock Gaxios response in acl and headers tests
thiyaguk09 01fc591
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 17ffbe5
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 3b19434
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 7d5c5ac
test: add bytes method to mock Gaxios response in acl and headers tests
thiyaguk09 7d41399
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 9379a79
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 2c0e9c8
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 9795e1d
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 fb221c3
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 696a337
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 82bf1ee
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 efaaf4b
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 fe055f7
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 2440361
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 e03e122
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 7218474
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 d4ee55c
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 9271939
lint fix
thiyaguk09 e2c0efc
Merge remote-tracking branch 'upstream/storage-node-18' into docs/gax…
thiyaguk09 de6b408
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 20fcb11
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 9519ae8
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 1819fe4
lint fix
thiyaguk09 041d008
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 85c50e2
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 0979efb
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 ba27a8f
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 948d035
lint fix
thiyaguk09 d235ddd
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 fc44591
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 a81e28d
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 018f71e
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 43fc1e8
lint fix
thiyaguk09 237814d
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 1946ca8
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 bae6491
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 aeb3a02
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 3217d07
lint fix
thiyaguk09 5b2fcef
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 6723f3e
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 43fc14b
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 3f1dcdf
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 0d373cf
lint fix
thiyaguk09 a7b6e27
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 0a993d6
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 4f16b2e
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 dae5c48
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 b1a54b0
lint fix
thiyaguk09 66bdc7c
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 de16592
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 82a2239
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 74e6d6b
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 f41a664
lint fix
thiyaguk09 0100a7a
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 111aa89
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 eaf8c63
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 a5aac31
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 b4ac2f3
lint fix
thiyaguk09 1ff2849
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 20e15b0
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 c9e4407
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 01223bc
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 72b5e10
lint fix
thiyaguk09 4aaba8a
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 b0498ea
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 40f27b2
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 4b31465
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 191e96c
lint fix
thiyaguk09 1e0e7cf
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 38849e1
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 2e8a5c9
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 929c38d
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 560a61b
lint fix
thiyaguk09 4b62544
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 2161bde
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 b52e1f7
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 58ec490
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 99d0a21
lint fix
thiyaguk09 9efafe2
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 487c6e3
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 7920b7e
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 a31e5be
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 d8af687
lint fix
thiyaguk09 d814f95
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 dbd46bc
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 7e8f9ec
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 ad50970
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 ae0485b
lint fix
thiyaguk09 d1c63b4
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 6ea2aee
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 321d91d
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 48db3ca
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 2686699
lint fix
thiyaguk09 dfe06aa
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 106c994
fix(storage): Invocation ID is not retained on multipart upload retri…
thiyaguk09 bebe7f1
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 8975172
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 b984e82
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 58ef9bf
lint fix
thiyaguk09 b16d16a
fix(storage): Invocation ID is not retained on multipart upload retri…
thiyaguk09 11d1cd3
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 c74628a
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 678f64c
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 676e767
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 fd0a8fc
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 c6cbede
lint fix
thiyaguk09 374f80d
fix(storage): Invocation ID is not retained on multipart upload retri…
thiyaguk09 44d015b
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 4937d6c
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 6ba890f
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 2ad86cc
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 4f26b73
lint fix
thiyaguk09 7b78138
fix(storage): Invocation ID is not retained on multipart upload retri…
thiyaguk09 937490d
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 9875e06
fix(storage): standardize URL formatting and enhance transport retry
thiyaguk09 7ec256e
refactor(storage): remove Service.ts and migrate logic to StorageTran…
thiyaguk09 690b5a1
fix(storage): resolve transport and retry issues (#8235)
thiyaguk09 4e72213
lint fix
thiyaguk09 81b96dc
fix(storage): Invocation ID is not retained on multipart upload retri…
thiyaguk09 a409ff8
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 652932c
Merge branch 'storage-node-18' into docs/gaxios-migration-guide
thiyaguk09 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # Storage v7 to v8 Migration Guide - Node.js 18 & Gaxios Update | ||
|
|
||
| This guide helps you migrate your application from `@google-cloud/storage` v7 to v8, focusing on the transition to Node.js 18+ as the minimum supported environment and changes introduced by updating the underlying HTTP client, `gaxios`, to version 7. | ||
|
|
||
| ## Minimum Requirements: Node.js 18 | ||
|
|
||
| `@google-cloud/storage` v8 now officially requires Node.js 18 or higher. This update aligns the library with modern JavaScript environments. | ||
|
|
||
| Specifically, Node.js 18 introduced native global Web APIs (such as `fetch` and `Headers`). Conforming to this standard, the underlying HTTP client, `gaxios` (updated to v7), leverages native `Headers` rather than custom user-land header representations. As a result, `@google-cloud/storage` v8 has transitioned response and request headers to standard native global `Headers` objects. | ||
|
|
||
|
|
||
| ## Key Breaking Changes for Storage Users | ||
|
|
||
| ### 1. Response Headers are now `Headers` objects | ||
|
|
||
| When you receive a full API response from Storage methods (e.g., via callbacks or promise resolutions that include the response object), the `headers` property of the response is now a standard native `Headers` object (aligned with the Fetch API standard in Node.js 18) rather than a plain JavaScript object. | ||
|
|
||
| **Before (Storage v7):** | ||
|
|
||
| ```js | ||
| const [retrievedFile, apiResponse] = await file.get(); | ||
| const contentType = apiResponse.headers['content-type']; | ||
| ``` | ||
|
|
||
| **After (Storage v8):** | ||
|
|
||
| ```js | ||
| const [retrievedFile, apiResponse] = await file.get(); | ||
| // Accessing headers requires the .get() method | ||
| const contentType = apiResponse.headers.get('content-type'); | ||
| ``` | ||
|
|
||
| ### 2. Passing Headers in Options | ||
|
|
||
| If you pass custom headers in options to Storage methods (which extend `GaxiosOptions`), you can still pass plain objects, as the Storage library will convert them to standard `Headers` internally for the request. However, if you read them back from the prepared options or response, they will be `Headers` objects. | ||
|
|
||
| **Before (Storage v7):** | ||
|
|
||
| ```js | ||
| // Reading request headers back from response metadata returned a plain object | ||
| const customHeader = apiResponse.config.headers['x-custom-header']; | ||
| ``` | ||
|
|
||
| **After (Storage v8):** | ||
|
|
||
| ```js | ||
| // Reading request headers back from response metadata requires .get() | ||
| const customHeader = apiResponse.config.headers.get('x-custom-header'); | ||
| ``` | ||
|
|
||
| > [!WARNING] | ||
| > **Header Value Stringification:** Plain JavaScript objects allow passing non-string values (such as arrays or numbers) which are implicitly processed. However, the native `Headers` constructor strictly converts all values to standard string representations. For example, passing an array of values (e.g., `['val1', 'val2']`) will result in a single comma-separated string (e.g., `'val1, val2'`). Ensure you pre-format or verify your header values before passing them to custom options. | ||
|
|
||
|
|
||
| ### 3. URL Resolution (`baseURL`) | ||
|
|
||
| If you are using custom `baseURL` options or passing relative URLs to methods that accept them, be aware that resolution now strictly follows the standard native `URL` constructor spec (`new URL(url, baseURL)`). This can affect how leading slashes in paths resolve. | ||
|
|
||
| **Before (Storage v7):** | ||
|
|
||
| Using standard path-joining custom resolution: | ||
| - `baseURL`: `https://storage.googleapis.com/storage/v1` | ||
| - `url`: `/b/my-bucket` | ||
| - Resolved URL: `https://storage.googleapis.com/storage/v1/b/my-bucket` | ||
|
|
||
| **After (Storage v8):** | ||
|
|
||
| Strictly resolved via the standard native `URL` constructor rules (where a leading slash resolves relative to the root of the host): | ||
| - `baseURL`: `https://storage.googleapis.com/storage/v1` | ||
| - `url`: `/b/my-bucket` | ||
| - Resolved URL: `https://storage.googleapis.com/b/my-bucket` (resolves relative to host root, stripping `storage/v1`) | ||
|
|
||
|
|
||
| ## Upgrade Instructions | ||
|
|
||
| Update your `@google-cloud/storage` dependency to version 8: | ||
|
|
||
| ```sh | ||
| npm install @google-cloud/storage@latest | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| - If you encounter `undefined` when accessing headers on the response object, ensure you are using `apiResponse.headers.get('header-name')`. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gaxios is indirect dependency?
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, it's direct dependency. |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add examples for 2 and 3 as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added