feat(feedback): Add `captureFeedback` method
This PR adds a new captureFeedback method which is exported from all SDKs.
This method can be used to capture a (new) user feedback from any package.
We follow the same semantics as for other capture methods like captureException() or captureMessage(): The method returns a string, which is the event id. We do not wait for sending to be successful or not, we just try to send it and return. You can both set an associatedEventId (which replaces the event_id of the "old" captureUserFeedback), and also pass attachments to send along (which for now are sent as a separate envelope).
For usage in the modal UI, there is still sendFeedback which continues to return a promise that resolves with the event ID, or rejects with a meaningful error message if sending fails.
This also deprecates captureUserFeedback(), which is only exported in browser. We cannot remove this yet because captureFeedback will only work on newer self-hosted instances, so not all users can easily update. We can/should remove this in v9.
Includes https://github.com/getsentry/sentry-javascript/pull/11626
size-limit report ๐ฆ
| Path | Size |
|---|---|
| @sentry/browser | 21.65 KB (+0.01% ๐บ) |
| @sentry/browser (incl. Tracing) | 32.69 KB (+0.01% ๐บ) |
| @sentry/browser (incl. Tracing, Replay) | 68.04 KB (+0.01% ๐บ) |
| @sentry/browser (incl. Tracing, Replay) - with treeshaking flags | 61.43 KB (+0.01% ๐บ) |
| @sentry/browser (incl. Tracing, Replay with Canvas) | 72.07 KB (+0.01% ๐บ) |
| @sentry/browser (incl. Tracing, Replay, Feedback) | 84.2 KB (-0.09% ๐ฝ) |
| @sentry/browser (incl. Feedback) | 37.69 KB (-0.39% ๐ฝ) |
| @sentry/browser (incl. sendFeedback) | 26.21 KB (-0.87% ๐ฝ) |
| @sentry/browser (incl. FeedbackAsync) | 30.77 KB (-0.65% ๐ฝ) |
| @sentry/react | 24.33 KB (+0.01% ๐บ) |
| @sentry/react (incl. Tracing) | 35.65 KB (+0.01% ๐บ) |
| @sentry/vue | 25.48 KB (+0.01% ๐บ) |
| @sentry/vue (incl. Tracing) | 34.48 KB (+0.01% ๐บ) |
| @sentry/svelte | 21.78 KB (+0.01% ๐บ) |
| CDN Bundle | 24.03 KB (+0.01% ๐บ) |
| CDN Bundle (incl. Tracing) | 34.05 KB (+0.01% ๐บ) |
| CDN Bundle (incl. Tracing, Replay) | 67.73 KB (+0.01% ๐บ) |
| CDN Bundle (incl. Tracing, Replay, Feedback) | 72.85 KB (-0.3% ๐ฝ) |
| CDN Bundle - uncompressed | 70.64 KB (+0.01% ๐บ) |
| CDN Bundle (incl. Tracing) - uncompressed | 101 KB (+0.01% ๐บ) |
| CDN Bundle (incl. Tracing, Replay) - uncompressed | 210.61 KB (+0.01% ๐บ) |
| CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed | 223.66 KB (-0.26% ๐ฝ) |
| @sentry/nextjs (client) | 34.87 KB (+0.01% ๐บ) |
| @sentry/sveltekit (client) | 33.25 KB (+0.01% ๐บ) |
| @sentry/node | 138.72 KB (+0.01% ๐บ) |
Feel free to merge https://github.com/getsentry/sentry-javascript/pull/11626 into this PR if it makes sense; otherwise we can also merge sequentially :)
So I updated this to send attachments in the same envelope! Makes everything easier.
With this change, I also removed the attachments option from captureFeedback() and sendFeedback(), instead leveraging this normally through the event hint. This means you have to do:
Sentry.captureFeedback({ message: 'xx' }, { attachments: [attachment1] });
Same as with all other capture methods.
The change on ingest to accept feedback and attachments on the same envelope was done through:
- https://github.com/getsentry/relay/pull/3403
This change has been live on SaaS and made it to self hosted: 24.4.2
- https://github.com/getsentry/relay/releases/tag/24.4.2
Assuming this PR sends feedback+attach in same envelope, let me know before you merge so I can turn on the ingest FF! I'ts only set in s4s right now.
- Turned on: accepts same envelope AND separate envs
- Turned off: only accepts separate envs Or you can make a PR to do so yourself like so: https://github.com/getsentry/sentry-options-automator/pull/1234
The change on ingest to accept feedback and attachments on the same envelope was done through:
This change has been live on SaaS and made it to self hosted: 24.4.2
- https://github.com/getsentry/relay/releases/tag/24.4.2