Skip to content
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

fix(nuget): gracefully accept a lack of a PackageBaseAddress resource #25355

Merged
merged 11 commits into from Oct 26, 2023

Conversation

dhduvall
Copy link
Contributor

Changes

"Fixes" a TypeError when finding releases of NuGet packages on GitLab.

Context

As documented in https://gitlab.com/gitlab-org/gitlab/-/issues/325835, the GitLab NuGet API is missing the PackageBaseAddress service. This results in a TypeError when deconstructing the first of the matching services (this is grabbed from the test output, which is why that first line is a little weird):

    {
      err: TypeError: Cannot destructure property 'serviceId' of '((cov_a1amzkyzn(...).s[55]++) , services.pop(...))' as it is undefined.
          at serviceId (/Users/duvall/src/renovate/lib/modules/datasource/nuget/v3.ts:76:13)
          at processTicksAndRejections (node:internal/process/task_queues:95:5)
          at Object.getReleases (/Users/duvall/src/renovate/lib/modules/datasource/nuget/v3.ts:198:32)
          at getRegistryReleases (/Users/duvall/src/renovate/lib/modules/datasource/index.ts:77:15)
          at mergeRegistries (/Users/duvall/src/renovate/lib/modules/datasource/index.ts:151:19)
          at fetchReleases (/Users/duvall/src/renovate/lib/modules/datasource/index.ts:297:15)
          at getPkgReleases (/Users/duvall/src/renovate/lib/modules/datasource/index.ts:387:31)
          at Object.<anonymous> (/Users/duvall/src/renovate/lib/modules/datasource/nuget/index.spec.ts:266:19),
      url: 'https://api.nuget.org/v3/index.json',
      servicesIndexRaw: {
        version: '3.0.0',
        resources: [ [Object], [Object], [Object], [Object], [Object], [Object] ]
      }
    } nuget registry failure: can't get PackageBaseAddress

Although the exception is caught and renovate continues, the error in the log is surprising and not especially helpful, so I'm preempting the exception with a custom one with a clearer message. There's still nothing that can be done about it, but anyone seeing it in the logs shouldn't be as confused.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@rarkins rarkins requested a review from zharinov October 24, 2023 05:53
auto-merge was automatically disabled October 24, 2023 16:54

Head branch was pushed to by a user without write access

@dhduvall dhduvall changed the title fix(nuget): gracefuly accept a lack of a PackageBaseAddress resource fix(nuget): gracefully accept a lack of a PackageBaseAddress resource Oct 25, 2023
@dhduvall dhduvall requested a review from viceice October 26, 2023 16:55
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

thanks

@viceice viceice added this pull request to the merge queue Oct 26, 2023
Merged via the queue into renovatebot:main with commit ddbce7d Oct 26, 2023
36 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 37.33.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants