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 "Cannot read properties of null" in cli/telemetry #8443

Merged
merged 2 commits into from Sep 7, 2023

Conversation

the-dijkstra
Copy link
Contributor

@the-dijkstra the-dijkstra commented Sep 6, 2023

Changes

Latest version of Astro is throwing the following error on CI:

error   Cannot read properties of null (reading 'name')
    File:
      node_modules/astro/dist/cli/telemetry/index.js:5:57
    Code:
      4 | async function notify() {
      > 5 |   const packageManager = (await whichPm(process.cwd())).name ?? "npm";
          |                                                         ^
        6 |   await telemetry.notify(() => {
        7 |     console.log(msg.telemetryNotice(packageManager) + "\n");
        8 |     return true;
    Stacktrace:
  TypeError: Cannot read properties of null (reading 'name')
      at notify (node_modules/astro/dist/cli/telemetry/index.js:5:57)
      at async runCommand (node_modules/astro/dist/cli/index.js:97:3)
      at async cli (node_modules/astro/dist/cli/index.js:144:5)

I will add changsets if this gets approved

Testing

Docs

@changeset-bot
Copy link

changeset-bot bot commented Sep 6, 2023

🦋 Changeset detected

Latest commit: 8c3ca89

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Sep 6, 2023
@jacobdalamb
Copy link
Contributor

jacobdalamb commented Sep 7, 2023

Oops, my mistake for forgetting to add the ? to it.
d2f2a11

Copy link
Member

@Princesseuh Princesseuh left a comment

Choose a reason for hiding this comment

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

Thanks, this looks great! Surprised this wasn't a type error 🤔

@Princesseuh Princesseuh merged commit 0fa4832 into withastro:main Sep 7, 2023
4 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Sep 7, 2023
@the-dijkstra the-dijkstra deleted the patch-1 branch September 7, 2023 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants