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

[Bug]: Unhandled rejection in telemetry #3867

Open
2 tasks done
frandiox opened this issue May 8, 2024 · 1 comment
Open
2 tasks done

[Bug]: Unhandled rejection in telemetry #3867

frandiox opened this issue May 8, 2024 · 1 comment
Labels
Area: Housekeeping Type: Bug Something isn't working

Comments

@frandiox
Copy link
Contributor

frandiox commented May 8, 2024

Please confirm that you have:

  • Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Hydrogen custom storefront

Expected behavior

Errors in internal telemetry should not be shown as unhandled rejections. The error should be caught and printed nicely, and maybe only as a debug log.

Actual behavior

For example, when running without internet connection, the following log shows up in the console when running a CLI command (e.g. shopify hydrogen dev):

Unhandled Rejection:  Error: getaddrinfo ENOTFOUND otlp-http-production-cli.shopifysvc.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'otlp-http-production-cli.shopifysvc.com'
}

Verbose output

2024-05-08T00:34:21.293Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 6 ms
With response headers:

    
2024-05-08T00:34:21.293Z: Failed to report usage analytics: request to https://monorail-edge.shopifysvc.com/v1/produce failed, reason: getaddrinfo ENOTFOUND monorail-edge.shopifysvc.com
2024-05-08T00:34:21.293Z: Completed command hydrogen dev
Unhandled Rejection:  Error: getaddrinfo ENOTFOUND otlp-http-production-cli.shopifysvc.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'otlp-http-production-cli.shopifysvc.com'
}

Reproduction steps

  1. Run a command without internet connection

Operating System

Mac OS Sonoma 14

Shopify CLI version (check your project's package.json if you're not sure)

3.59.2

Shell

zsh

Node version (run node -v if you're not sure)

v18.7.1

What language and version are you using in your application?

No response

@frandiox frandiox added the Type: Bug Something isn't working label May 8, 2024
@gonzaloriestra
Copy link
Contributor

Hi, thanks for reporting!

I'm not able to reproduce. I tried by disabling the internet connection, but I can't see any telemetry error. For example, with hydrogen dev, I only get this one:

╭─ warning ───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                         │
│  Failed to fetch Hydrogen changelog                                                                                     │
│                                                                                                                         │
│  Ensure you have internet connection and try again                                                                      │
│                                                                                                                         │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Looking at the code, it seems that we are already catching errors and printing only to debug log:

I've also updated the CLI code to always throw an error when reporting analytics, but it only shows the expected debug log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Housekeeping Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants