Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.

chore!: migrate to Node 18#2592

Merged
ddelgrosso1 merged 25 commits intonode-18from
migrate-node-18
Jun 17, 2025
Merged

chore!: migrate to Node 18#2592
ddelgrosso1 merged 25 commits intonode-18from
migrate-node-18

Conversation

@thiyaguk09
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

@product-auto-label product-auto-label bot added size: l Pull request size is large. api: storage Issues related to the googleapis/nodejs-storage API. labels Apr 21, 2025
@thiyaguk09 thiyaguk09 changed the title chore: Migrate to node 18 chore!: migrate to Node 18 Apr 21, 2025
Resolve the ES module compatibility issue for the mime and p-limit
modules.
@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels Apr 23, 2025
@ddelgrosso1 ddelgrosso1 marked this pull request as ready for review April 28, 2025 19:21
@ddelgrosso1 ddelgrosso1 requested a review from a team April 28, 2025 19:21
@ddelgrosso1 ddelgrosso1 requested a review from a team as a code owner April 28, 2025 19:21
@ddelgrosso1 ddelgrosso1 marked this pull request as draft April 28, 2025 19:23
@generated-files-bot
Copy link

generated-files-bot bot commented Apr 29, 2025

Warning: This pull request is touching the following templated files:

  • .github/workflows/ci.yaml - .github/workflows/ci.yaml (GitHub Actions) should be updated in synthtool

@thiyaguk09 thiyaguk09 marked this pull request as ready for review April 30, 2025 11:50
@snippet-bot
Copy link

snippet-bot bot commented Apr 30, 2025

No region tags are edited in this PR.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

headers?: {[key: string]: string};
}

interface MultiPartUploadErrorResponse {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we adding new types to this file?

Copy link
Contributor Author

@thiyaguk09 thiyaguk09 May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix the "Property 'error' does not exist on type '{}'" issue, TypeScript defaults to {} without a specific type, which means no properties are guaranteed. Use MultiPartUploadErrorResponse to tell TypeScript that res.data may have an error property.

@organize
Copy link

What's the schedule on this / anything that can be helped with? I'm facing various issues in the current gaxios / node-fetch versions that have been fixed later.

@thiyaguk09 thiyaguk09 requested a review from ddelgrosso1 May 21, 2025 06:44
@organize
Copy link

organize commented May 28, 2025

Forked this for testing, I'll update this comment in case I find anything.

  • Is the change in file.delete intended? The request contains a double forward-slash: DELETE /storage/v1/b/$some_bucket//o/$some_object
  • a similar change can be seen with file.setMetadata
  • file.delete seems to hang as the callback is never invoked (see service-object.ts#L304)

@ddelgrosso1
Copy link
Contributor

Forked this for testing, I'll update this comment in case I find anything.

  • Is the change in file.delete intended? The request contains a double forward-slash: DELETE /storage/v1/b/$some_bucket//o/$some_object
  • a similar change can be seen with file.setMetadata
  • file.delete seems to hang as the callback is never invoked (see service-object.ts#L304)

cc: @thiyaguk09

@thiyaguk09
Copy link
Contributor Author

Forked this for testing, I'll update this comment in case I find anything.

  • Is the change in file.delete intended? The request contains a double forward-slash: DELETE /storage/v1/b/$some_bucket//o/$some_object
  • a similar change can be seen with file.setMetadata
  • file.delete seems to hang as the callback is never invoked (see service-object.ts#L304)

Thanks for forking and testing! I appreciate you digging into that.

Regarding the double forward-slash in DELETE /storage/v1/b/$some_bucket//o/$some_object for file.delete and file.setMetadata, that's definitely not intended and sounds like a bug. The hanging callback on file.delete is also a critical issue.

I'm currently tied up with some urgent work, but I'll make sure to prioritize looking into these issues as soon as I can. Your detailed findings are really helpful!

@organize organize mentioned this pull request May 29, 2025
4 tasks
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: xl Pull request size is extra large. labels Jun 5, 2025
@thiyaguk09 thiyaguk09 requested a review from ddelgrosso1 June 5, 2025 07:38
@organize
Copy link

organize commented Jun 5, 2025

Deleting files will still hang after the above commits, and the test doesn't catch it because it explicitly calls done from the mocked function. Check out the diff here: https://github.com/googleapis/nodejs-storage/pull/2596/files

I believe I've also found another regression in file.ts#L1702:

      this.storageTransport
        .makeRequest(reqOpts, async (err, stream, rawResponse) => {
          (stream as Readable).on('error', err => {
            throughStream.destroy(err);
          });

The cast here might be erroneous. Looking at Gaxios documentation, specifically GaxiosOptions.responseType:

    /**
     * If the `fetchImplementation` is native `fetch`, the
     * stream is a `ReadableStream`, otherwise `readable.Stream`
     */
    responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'stream' | 'unknown';

I'm not sure if an user can override the fetch implementation, but assuming they can't, the correct type is ReadableStream.

This results in the following error: Cannot read properties of null (reading 'on')

Thoughts?

@ddelgrosso1
Copy link
Contributor

@thiyaguk09 can you address the comments from @organize. Also, do you know why the docs CI check is 429'ing on a bunch of samples now?

@thiyaguk09
Copy link
Contributor Author

can you address the comments from @organize. Also, do you know why the docs CI check is 429'ing on a bunch of samples now?

Sure, I’ll address the comments from @organize. Regarding the docs CI check returning 429 errors on several samples, I’ll investigate the cause—could be rate limiting or a recent config change. Will update shortly.

@organize
Copy link

There still seems to be a regression in downloading objects, and using ReadableStream didn't help.

I believe I've also found another regression in file.ts#L1702:

      this.storageTransport
        .makeRequest(reqOpts, async (err, stream, rawResponse) => {
          (stream as Readable).on('error', err => {
            throughStream.destroy(err);
          });

Here, for some reason, stream is null intermittently. I'll try to track it down further.

@organize
Copy link

Turns out I was missing storage.objects.get from some of my earlier testing. I'm pretty sure the IAM-related error is being swallowed now, with Cannot read properties of null (reading 'on') being thrown instead.

@ddelgrosso1 ddelgrosso1 merged commit 6b84d2d into node-18 Jun 17, 2025
12 of 13 checks passed
@ddelgrosso1 ddelgrosso1 deleted the migrate-node-18 branch June 17, 2025 14:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: storage Issues related to the googleapis/nodejs-storage API. size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants