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
ERR_INVALID_URL
for next config rewrite option
#6381
Comments
Hi, you're not mapping the DSN to a URL correctly. You still have the part with You need to map it from |
Also, have you set a proper dsn in your init calls? |
Sorry, my report yesterday wasn't well structured, I hadn't slept well. The back story of this report, is that it was working early last year, then a combination of moving to production (on Vercel) and upgrading next broke my code. I had a long standing bug report on next that I've now been asked to reproduce the issue with canary. I have since worked around the original issue using tunneling
Yes: import * as Sentry from "@sentry/nextjs";
const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
Sentry.init({
dsn: SENTRY_DSN || "https://publickey@o111111.ingest.sentry.io/yyyyy",
tunnel: "/sentry"
})
That doesn't appear the be the issue, if I make the following change, it still has the const sentryProxyURLwithUser = sentryUrl.toString();
const sentryProxyURL = 'https://' + sentryProxyURLwithUser.split(/@/)[1];
console.log(sentryProxyURL); /// https://o111111.ingest.sentry.io/api/yyyy/envelope/ The issue is that @sentry/next seems to calling $ node
Welcome to Node.js v16.18.1.
Type ".help" for more information.
> const url = await import("url");
undefined
> new URL("/sentry")
Uncaught TypeError [ERR_INVALID_URL]: Invalid URL
at __node_internal_captureLargerStackTrace (node:internal/errors:478:5)
at new NodeError (node:internal/errors:387:5)
at URL.onParseError (node:internal/url:565:9)
at new URL (node:internal/url:641:5) {
input: '/sentry',
code: 'ERR_INVALID_URL'
} I have just noticed that in my comment on the tunnelling example I did mention solving the Regardless of what is causing it, it's not easy to track down what the cause of the error is, and it might be something |
in which init call are you setting |
Having |
Right. Unless you actually want to tunnel server events that originate from the server (can't think of a use case here), you should set the |
Yes, of course. However, the error message doesn't tell me this, and it took quite a bit of debugging to come to that conclusion; it would have saved me some debugging cycles if sentry had verified my config was correct. |
We should probably clarify the docs that the common use case for Could you resolve your issue? |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
If the tunnel option will cause an error to be thrown, catch it, and re-throw with a better error message. Fixes getsentryGH-6381
I added a PR to throw a better error message |
@Naddiseo thanks for opening a PR. Just out of curiosity, how are you using tunneling serverside? Normally it is just something you would do on the browser because of ad blockers. |
Adding tunneling server side was by accident because I didn't read the docs close enough and I had copy/pasted the client config into the server one. Then I got very confused by this error message. |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/nextjs
SDK Version
7.23.0
Framework Version
13.0.6-canary.3
Link to Sentry event
No response
Steps to Reproduce
next build
Expected Result
It should build correctly.
Actual Result
The text was updated successfully, but these errors were encountered: