getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.79k stars 1.53k forks source link

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

Open Stanzilla opened 7 months ago

Stanzilla commented 7 months ago

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

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
Stanzilla commented 7 months ago

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 commented 7 months ago

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

billyvg commented 7 months ago

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

billyvg commented 6 months ago

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

{detail: "event submission rejected with_reason: Cors"}
Stanzilla commented 6 months ago

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?"