Skip to content

Sentry.captureFeedback produces unviewable images in sentry.io #12599

@Saturate

Description

@Saturate

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

8.9.2

Framework Version

nextjs 14.2.2

Link to Sentry event

https://impact-as-01.sentry.io/feedback/?feedbackSlug=dagrofa-spa:1699972&project=4507299065954384

SDK Setup

No response

Steps to Reproduce

We are using the Feedback API to submit user feedback, we tried adding support for uploading images, however these do not show up correctly in Sentry.

We are converting a file to base 64 with a function like this that uses FileReader

 const convertBase64 = (file: File) => {
    return new Promise((resolve, reject) => {
      const fileReader = new FileReader();
      fileReader.onload = () => {
        resolve(fileReader.result);
      };
      fileReader.onerror = (error) => {
        reject(error);
      };
      fileReader.readAsDataURL(file);
    });
  };

It ends up like this string (concatinated):

data:image/jpeg;base64,/9j/4AAQSkZJRgABAQE....AHwAAAQ9k=

This works file when trying to view it with <img src="data-here" /> but it's not working in sentry. I'm suspecting that the docs on https://docs.sentry.io/platforms/javascript/user-feedback/#user-feedback-api is not 100% clear on the base64 expected.

Expected Result

Getting a image that's viewable in sentry.

Actual Result

Broken image.
Screenshot 2024-06-21 at 13 37 04

Metadata

Metadata

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions