Skip to content

ref(feedback): Use debug instead of logger #17027

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

Merged
merged 1 commit into from
Jul 15, 2025
Merged

Conversation

AbhiPrasad
Copy link
Member

resolves #16949

@AbhiPrasad AbhiPrasad requested a review from a team July 15, 2025 19:51
@AbhiPrasad AbhiPrasad self-assigned this Jul 15, 2025
@AbhiPrasad AbhiPrasad requested review from stephanie-anderson and s1gr1d and removed request for a team July 15, 2025 19:51
@AbhiPrasad AbhiPrasad requested a review from a team as a code owner July 15, 2025 19:51
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Incorrect `debug` Usage Causes Errors

The debug function from @sentry/core was incorrectly used as an object with an error method (e.g., debug.error(...)), replacing previous logger.error(...) calls. As debug is a function, not an object, this causes a TypeScript compilation error and, in debug builds, a runtime TypeError: debug.error is not a function. This issue breaks feedback-related flows in files like Form.tsx and core/integration.ts.

packages/feedback/src/modal/components/Form.tsx#L128-L135

},
{ attachments: data.attachments },
);
onSubmitSuccess(data, eventId);
} catch (error) {
DEBUG_BUILD && debug.error(error);
setError(error as string);
onSubmitError(error as Error);

packages/feedback/src/core/integration.ts#L193-L247

modalIntegration = modalIntegrationFn() as FeedbackModalIntegration;
addIntegration(modalIntegration);
} catch {
DEBUG_BUILD &&
debug.error(
'[Feedback] Error when trying to load feedback integrations. Try using `feedbackSyncIntegration` in your `Sentry.init`.',
);
throw new Error('[Feedback] Missing feedback modal integration!');
}
try {
const screenshotIntegrationFn = screenshotRequired
? getScreenshotIntegration
? getScreenshotIntegration()
: await lazyLoadIntegration('feedbackScreenshotIntegration', scriptNonce)
: undefined;
if (screenshotIntegrationFn) {
screenshotIntegration = screenshotIntegrationFn() as FeedbackScreenshotIntegration;
addIntegration(screenshotIntegration);
}
} catch {
DEBUG_BUILD &&
debug.error('[Feedback] Missing feedback screenshot integration. Proceeding without screenshots.');
}
const dialog = modalIntegration.createDialog({
options: {
...options,
onFormClose: () => {
dialog?.close();
options.onFormClose?.();
},
onFormSubmitted: () => {
dialog?.close();
options.onFormSubmitted?.();
},
},
screenshotIntegration,
sendFeedback,
shadow: _createShadow(options),
});
return dialog;
};
const _attachTo = (el: Element | string, optionOverrides: OverrideFeedbackConfiguration = {}): Unsubscribe => {
const mergedOptions = mergeOptions(_options, optionOverrides);
const targetEl =
typeof el === 'string' ? DOCUMENT.querySelector(el) : typeof el.addEventListener === 'function' ? el : null;
if (!targetEl) {
DEBUG_BUILD && debug.error('[Feedback] Unable to attach to target element');
throw new Error('Unable to attach to target element');

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@AbhiPrasad AbhiPrasad enabled auto-merge (squash) July 15, 2025 20:31
@AbhiPrasad AbhiPrasad merged commit 465f64d into develop Jul 15, 2025
253 of 255 checks passed
@AbhiPrasad AbhiPrasad deleted the abhi-debug-feedback branch July 15, 2025 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate feedback package to use debug
2 participants