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

User Feedback: Show better message if submission was rejected due to allowedDomains #9856

Closed
3 tasks done
Stanzilla opened this issue Dec 14, 2023 · 7 comments · Fixed by #13441
Closed
3 tasks done

Comments

@Stanzilla
Copy link

Stanzilla commented Dec 14, 2023

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

7.86.0

Framework Version

Next ^14.0.4

Link to Sentry event

No response

SDK Setup

Sentry.init({
  dsn: SENTRY_DSN,
  environment,

  // Adjust this value in production, or use tracesSampler for greater control, default: 1
  tracesSampleRate: 0.1,

  // Setting this option to true will print useful information to the console while you're setting up Sentry.
  debug: false,

  replaysOnErrorSampleRate: 1.0,

  // This sets the sample rate to be 10%. You may want this to be 100% while
  // in development and sample at a lower rate in production
  replaysSessionSampleRate: 0.1,

  // You can remove this option if you're not planning to use the Sentry Session Replay feature:
  integrations: [
    new Sentry.Replay({
      // For additional Replay configuration see https://docs.sentry.io/platforms/javascript/session-replay/configuration/
      maskAllText: false,
      blockAllMedia: false,
    }),
    new Sentry.Feedback({
      // For additional SDK configuration see https://docs.sentry.io/platforms/javascript/user-feedback/configuration/
      colorScheme: 'dark',
      showBranding: false,
      themeDark: {
        background: '#292937',
        backgroundHover: '#393949',
        inputBackground: '#1e1e28',
        inputForeground: '#84849e',
        inputOutlineFocus: '#39394d',
        submitBackground: '#3e4784',
        submitBackgroundHover: '#505ba9',
        submitBorder: '#616ec7',
      },
    }),
  ],
})

Steps to Reproduce

  • Click on "Report a bug" button
  • Enter any text in any field

Expected Result

Feedback gets sent

Actual Result

Error: There was a problem submitting feedback, please wait and try again.

Sadly also nothing in the console that would help me debug. I tested this locally and on a vercel preview deploy.

I have Early Adopter enabled:

image

And I do have Vercel previews and localhost in the allowed domains:

*-SITENAME.vercel.app
localhost
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Dec 14, 2023
@github-actions github-actions bot added the Package: nextjs Issues related to the Sentry Nextjs SDK label Dec 14, 2023
@Stanzilla
Copy link
Author

Seems to work now..weird. Maybe the allowed domains took a while to kick in. I would appreciate though if the error message was a little more descriptive and this was easier to debug, leaving the ticket open because of that. If you'd rather have me make a new one just for that, please let me know.

@lforst lforst added Package: nextjs Issues related to the Sentry Nextjs SDK Feature: User Feedback Product Area: User Feedback and removed Package: nextjs Issues related to the Sentry Nextjs SDK labels Dec 18, 2023
@lforst
Copy link
Member

lforst commented Dec 18, 2023

@billyvg @c298lee you mind taking a look at this?

@billyvg
Copy link
Member

billyvg commented Dec 18, 2023

We'll take a look and see if it's allowed domains related.

@billyvg billyvg self-assigned this Dec 18, 2023
@billyvg billyvg changed the title User Feedback: There was a problem submitting feedback, please wait and try again. User Feedback: Show better message if submission was rejected due to allowedDomains Jan 2, 2024
@billyvg billyvg removed their assignment Jan 2, 2024
@billyvg
Copy link
Member

billyvg commented Jan 2, 2024

We could maybe show a different error message if we get a 403 response with this body:

{detail: "event submission rejected with_reason: Cors"}

@billyvg billyvg removed Type: Bug Package: nextjs Issues related to the Sentry Nextjs SDK labels Jan 2, 2024
@Stanzilla
Copy link
Author

We could maybe show a different error message if we get a 403 response with this body:

{detail: "event submission rejected with_reason: Cors"}

I think anything that points the user into the right direction would help, if you can be sure, why not add something like "Are you sure you have added this domain to the list of allowed domains?"

@chrisweb
Copy link

chrisweb commented Aug 15, 2024

I currently have this exact problem, my requests failed with a 403 code but I did not know why

Then I saw that the response had: {detail: "event submission rejected with_reason: Cors"}

This sent me into the wrong direction as I spent time on figuring out why CORS would be a problem

After a while I remembered I had made changes to the allowed domain list, so I set the list back to '*' and then everything worked, so I figured out the problem is my allowed domains list, however I have no clue which domain is causing the problem

So a message like: "request blocked because domain XY is not in the allowed list", would help a lot

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Aug 15, 2024
@chargome
Copy link
Member

Thanks @chrisweb, it's on our list.

c298lee added a commit that referenced this issue Aug 26, 2024
If the domain is not in `Allowed Domains` in the Sentry project
settings, it would cause a 403 error. The default setting is `*` so this
only occurs when the user changes these settings.

Fixes #9856
Zen-cronic pushed a commit to Zen-cronic/sentry-javascript that referenced this issue Aug 26, 2024
If the domain is not in `Allowed Domains` in the Sentry project
settings, it would cause a 403 error. The default setting is `*` so this
only occurs when the user changes these settings.

Fixes getsentry#9856
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Archived in project
Archived in project
Development

Successfully merging a pull request may close this issue.

6 participants