getsentry / sentry-javascript

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

Allow manual screenshot upload in User Feedback widget #12938

Open fabregas4 opened 1 month ago

fabregas4 commented 1 month ago

Problem Statement

Some environments require an app to be loaded within an iframe (e.g. Shopify embedded apps). Clicking 'Add a screenshot' on the User Feedback widget shows a message of: Failed to execute 'getDisplayMedia' on 'MediaDevices': Access to the feature "display-capture" is disallowed by permission policy.

As I understand, this is because the iFrame hasn't given permission for native screenshots. I realise there's not much you can do about that, but it would be nice if as a fallback, Sentry could revert to a regular file upload field so a user can upload their own screenshots, as it can be quite an important part of a bug report.

Solution Brainstorm

It could either fall back automatically, or it could be another config option, e.g. enableFileUpload or enableImageUpload

Then those that know their app is used in an environment where the screen capture API is not available, could set enableScreenshot to false and enableImageUpload to true.

andreiborza commented 1 month ago

Hey, thank you for taking the time to file this. I'll pass this on internally.