-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
Allow MIME detection for crashpad attachments in the backend #955
Comments
Routing to @getsentry/product-owners-issues for triage ⏲️ |
Assigning to @getsentry/support for routing ⏲️ |
Hi @Kobby-Bawuah as instructed by you via support ticket email I'm adding-on to this ticket. My team is experiencing the same issue when trying to preview attachments. Here is the content of the ticket I have created: I'm reaching out because my team have been encountering an issue with the Sentry platform. Specifically, we are unable to preview .txt and .log files at the attachment section of an issue. Steps to Reproduce:
Expected Behavior: Actual Behavior: Additional Information:
Issue URL: https://pdf-pro-software-inc.sentry.io/share/issue/343f0f0abc474a21b1a8145c92fbf3a3/ Attachment(s) |
thanks for the thorough message @rodrigo-vilela-pdfpro. I'm looking into this problem now, but does adding in the contentType like Kobby mentioned in the original message help solve the problem? |
Hi @roggenkemper, sorry for the delay on answering here. We have checked the suggested approach and we do not see how we can set content type for crash reports attachment, there is no such API in sentry.h. We have tried to set it in the Sentry SDK source code, we tried to change "application/x-sentry-envelope" to "application/json", but that did not help. See: https://github.com/getsentry/sentry-native/blob/master/src/sentry_transport.c#L8 Interestingly enough, we have identified that it is possible to preview attachment for custom error events, but not for crash reports. Here is an example of this:
Additional info from our side:
Could you guide us on the specific changes needed in the Sentry native SDK for crash reports to enable the preview feature? |
@rodrigo-vilela-pdfpro thanks for following up with all this information! It looks like the native SDK might have a gap here. I'll transfer this issue to that repo and see if the folks there can help. |
You are right, there currently is no API to set an explicit content-type for attachments. Also the code you pointed to is completely different, and you should not change the An envelope includes all the metadata related to an event, with different items. Things like the event JSON payload, attachments, sessions, etc. That being said, attachments are very bare-bones right now, and only really have a file path you register them with and thats it. Adding more metadata to it is possible, but would either inflate the API surface by adding new functions, or a breaking change which is a lot less likely. |
Closing this as the work required to fix this is captured in #894 - which currently has medium priority, but we'll revisit if we want to bump prio. |
@kahest The relevant part of this particular issue is that seemingly, for regular events, there seems to be some kind of content-type/mime-type detection in the backend that automatically assigns the type (according to file-extension?), but not for minidump events. |
@supervacuus I see - does it make sense to track this in this issue separately? |
I think it does because it means that our attachments are generally MIME-detected and don't require our users to provide a content type manually. The other ticket might still make sense for the latter, but I think most users would be happy with the MIME detection in the backend if it actually runs rather than having to provide a content type for each attachment. So, #894 is more work and a less valuable feature. So, the issue boils down to:
I know that the Also, after a quick search in the backend, it seems like an attachment without a I have no way of seeing how attachments are processed, though, so I would need support from an employee when testing this. If it turns out we can fix this at that point, I think it would be an extremely valuable fix and little effort. |
As discussed:
Next step: Let's adapt Crashpad handler and test this locally |
related Relay PR: getsentry/relay#3225 |
Hello, |
Hi @aallrd, We are currently working on integrating a change to the pipeline that would let attachment MIME detection run in the backend without you having to specify a content type in the SDK or change the file extension. |
Environment
SaaS (https://sentry.io/)
Steps to Reproduce
Attach a JSON file and try to view it within the issue page. The preview option is greyed out with the text:
Attachment cannot be previewed
A user got around this by adding
contentType
.It's a property on the attachment object
const filename = 'XXX.json';
const contentType = 'application/json'; // helps show Preview in Sentry
hint.attachments = hint.attachments || [];
hint.attachments.push({ filename, data, contentType });
We should try to derive the content type from the file name.
Expected Result
Can view the payload in the issue.
Actual Result
Product Area
Issues
Link
No response
DSN
No response
Version
No response
The text was updated successfully, but these errors were encountered: