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

Check that pkg.maintainers is defined before checking it's length #2069

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

PatrickStankard
Copy link
Contributor

@PatrickStankard PatrickStankard commented Jun 20, 2024

♻️ Current situation

For some reason, NPM doesn't seem to be setting the maintainers key on packages in the registry right now. I only noticed this because I was seeing this error in the Homebridge UI after publishing an update to a package:

[6/20/2024, 6:17:45 PM] [Homebridge UI] [homebridge-fujitsu-airstage] Failed to check registry.npmjs.org for updates: "Cannot read properties of undefined (reading 'length')" - see https://homebridge.io/w/JJSz6 for help.

💡 Proposed solution

Check that pkg.maintainers is defined before checking it's length

@github-actions github-actions bot added the latest Related to Latest Branch label Jun 20, 2024
Copy link
Contributor

@bwp91 bwp91 left a comment

Choose a reason for hiding this comment

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

lgtm thanks!

@bwp91 bwp91 requested a review from donavanbecker June 20, 2024 19:34
@ebaauw
Copy link
Contributor

ebaauw commented Jun 22, 2024

Patched my environment with this fix. The source also seems to end up in dist/main.js, from where the error is caught - I still don't understand typescript in full.

Anyways, this PR solves the missing menu items, but doesn't solve the missing author. The author still seems to be in the response, under _npmUser/name.

@ebaauw ebaauw changed the title Check that pkg.containers is defined before checking it's length Check that pkg.maintainers is defined before checking it's length Jun 22, 2024
@PatrickStankard
Copy link
Contributor Author

It’s supposed to be set on the NPM side automatically, according to this:

npm also sets a top-level "maintainers" field with your npm user info.

I filed a support ticket with them and started a thread on their GitHub community page, here, if you all want to comment there

@ebaauw
Copy link
Contributor

ebaauw commented Jun 22, 2024

maintainers is still there on the top level of a package; it's no longer included at the version level of recently published versions. So when only getting the latest version of a package, the info is missing.

@mkz212
Copy link
Contributor

mkz212 commented Jun 22, 2024

If you want to fix errors in plugins (until this patch will be released) you need to:

  • add to package.json: "maintainers": ["maintainer-name"]
  • publish latest release (not beta)

I think that this patch should be released ASAP, cause every new public release without maintainers in package.json will generate errors.

And maybe not only first maintainer? Maybe first 4 maintainers?

ebaauw added a commit to ebaauw/homebridge-ws that referenced this pull request Jun 22, 2024
@ebaauw
Copy link
Contributor

ebaauw commented Jun 22, 2024

@mkz212's workaround seems to work. Note that it's actually "maintainers": ["maintainer-name"] (using a colon instead of an equals sign).

@mkz212
Copy link
Contributor

mkz212 commented Jun 22, 2024

@mkz212's workaround seems to work. Note that it's actually "maintainers": ["maintainer-name"] (using a colon instead of an equals sign).

Sorry, yes, colon!

ebaauw added a commit to ebaauw/homebridge-zp that referenced this pull request Jun 22, 2024
Workaround for npm / Homebridge UI issue homebridge/homebridge-config-ui-x#2069.
donavanbecker added a commit that referenced this pull request Jun 22, 2024
## v4.56.3 (2024-06-22)

### Fixed

- Check that pkg.maintainers is defined before checking it's length (#2069) (@PatrickStankard)
donavanbecker added a commit that referenced this pull request Jun 22, 2024
- Check that pkg.maintainers is defined before checking it's length (#2069) (@PatrickStankard)
@donavanbecker
Copy link
Contributor

4.56.3 should be released soon.

@donavanbecker
Copy link
Contributor

Ran into a test coverage issue that needs to be resolved first

donavanbecker added a commit that referenced this pull request Jun 22, 2024
- Check that pkg.maintainers is defined before checking it's length (#2069) (@PatrickStankard)
donavanbecker added a commit that referenced this pull request Jun 22, 2024
- Check that pkg.maintainers is defined before checking it's length (#2069) (@PatrickStankard)
donavanbecker added a commit that referenced this pull request Jun 22, 2024
- Check that pkg.maintainers is defined before checking it's length (#2069) (@PatrickStankard)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
latest Related to Latest Branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants