Skip to content

User Feedback integration not working with scopes #13990

Closed as not planned
Closed as not planned

Description

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/browser

SDK Version

8.34.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

const integrations = getDefaultIntegrations({}).filter((defaultIntegration) => {
  return !['BrowserApiErrors', 'Breadcrumbs', 'GlobalHandlers'].includes(
    defaultIntegration.name,
  );
});

const feedback = feedbackIntegration({
  autoInject: false,
  colorScheme: 'light',
  showScreenshot: true,
  onSubmitError: (error: Error) => {
    console.log('onSubmitError', error);
  },
});

const client = new BrowserClient({
  dsn: import.meta.env.VITE_SCENTRY_DSN,
  transport: makeFetchTransport,
  stackParser: defaultStackParser,
  integrations: [...integrations, feedback],
});

export const scope = new Scope();
scope.setClient(client);

client.init();

Steps to Reproduce

console.log(getFeedback()) // return undefined
console.log(scope.getClient()?.getIntegrationByName('Feedback')) // return feedbackIntegration

captureFeedback(
    {
      name: 'Jane Doe', 
      email: '[email protected]',
      message: 'This is an example feedback',
    },
    {},
    scope,
); // sends feedback

const form = await feedback.createForm();
form.appendToDom();
form.open();

Try to submit feedback form

Expected Result

  1. I can bind feedback to my scope
  2. getFeedback() return feedbackIntegration with my scope

Actual Result

Catch the error when submit form

onSubmitError Error: No client setup, cannot send feedback.
setCurrentClient(client);
console.log(getFeedback()) // return feedbackIntegration

After that feedback form is submits without errors

Activity

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

Metadata

Assignees

No one assigned

    Type

    Projects

    • Status

      Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions