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

TypeError: Invalid URL is thrown from the Undici integration #8145

Closed
3 tasks done
sbellone opened this issue May 17, 2023 · 5 comments · Fixed by #8147
Closed
3 tasks done

TypeError: Invalid URL is thrown from the Undici integration #8145

sbellone opened this issue May 17, 2023 · 5 comments · Fixed by #8147

Comments

@sbellone
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

7.51.2

Framework Version

No response

Link to Sentry event

https://algolia-site-search-crawler.sentry.io/issues/4155211403/?project=1260143

SDK Setup

Sentry.init({
    dsn: process.env.SENTRY_DSN,
    release: `${version}@${commit}`,
    environment: process.env.CLUSTER_NAME || process.env.NODE_ENV,
    serverName: name,
    maxBreadcrumbs: 10,
    beforeSend: (event, hint) => {
      const exception = hint?.originalException;

      if (exception) {
        if (exception instanceof RabbitMQAckMessageOnOldChannelError) {
          // eslint-disable-next-line no-param-reassign
          event.fingerprint = ['RabbitMQAckMessageOnOldChannelError'];
        }
      }

      return event;
    },
  });

Steps to Reproduce

Run our process as before

Expected Result

No unhandled error coming from the Undici integration

Actual Result

Those unhandled errors started to make our processes crash, immediately after we updated to Sentry v7.50, which enables the Undici integration by default (#7967):
image

@AbhiPrasad
Copy link
Member

Hey @sbellone thanks for writing in! Crashing is really bad so we're on it to fix asap!

What Node version are you on? Is there also a way to tell what the request is? Wondering why the URL is invalid here. Thanks!

@sbellone
Copy link
Author

Thanks for your quick answer @AbhiPrasad.
Node v18.16.0.
Unfortunately I haven't find any info about what URL it is nor where the initial call is coming from. An Invalid URL error normally has a input field with the invalid URL, but I think it's not reported anywhere:

new URL('test')
Uncaught TypeError [ERR_INVALID_URL]: Invalid URL
    at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
    at new NodeError (node:internal/errors:399:5)
    at new URL (node:internal/url:560:13) {
  input: 'test',
  code: 'ERR_INVALID_URL'
}

@sbellone sbellone changed the title TypeError: Invalid URL is coming from the Undici integration TypeError: Invalid URL is thrown from the Undici integration May 17, 2023
@AbhiPrasad
Copy link
Member

To help us debug, is it possible you can set includeLocalVariables: true in your Sentry.init (see more details here: https://blog.sentry.io/local-variables-for-nodejs-in-sentry/) and provide us the values of what request/request.path/request.message was? This would allow us to debug further into why this case is happening.

If you cannot turn this on no worries, we will still work toward reproducing/fixing this! Appreciate the patience.

@sbellone
Copy link
Author

It's on our prod sorry, we'll stick with v7.49 for now. Thanks again for the quick response.

@AbhiPrasad
Copy link
Member

We'll cut a patch release today that should hopefully fix this. Sorry for the inconvenience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants