cli icon indicating copy to clipboard operation
cli copied to clipboard

[Bug]: Unhandled rejection in telemetry

Open frandiox opened this issue 1 year ago • 0 comments

Please confirm that you have:

  • [X] 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.)
  • [X] 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 avatar May 08 '24 00:05 frandiox