sentry-ruby icon indicating copy to clipboard operation
sentry-ruby copied to clipboard

File/attachment uploads

Open kornate opened this issue 4 years ago • 18 comments

Practically all the other SDKs support file/attachment uploads.

We are new to Sentry and are looking to capture screenshots for errors.

Is this on the roadmap? Is there a short term workaround or solution?

Thanks!

kornate avatar Aug 22 '21 10:08 kornate

Can you share more on how you'd use this feature? Like what screenshots do you generate in the backend and how? More detail will help us assess the need for this feature and plan the implementation (if we think it's necessary).

st0012 avatar Aug 23 '21 08:08 st0012

Hi @st0012! More information in how this is supported and used in Sentry.io's other SDKs is here, it's how I heard of the feature: https://blog.sentry.io/2021/02/03/how-to-use-sentry-attachments-with-mobile-applications

For us, we are looking at capturing browser DOM screenshots for errors.

kornate avatar Sep 02 '21 09:09 kornate

sentry-ruby doesn't run in browsers. how do you plan to capture browser screenshots with it?

st0012 avatar Sep 02 '21 11:09 st0012

Correct, but sentry-ruby doesn't need to run in the browser. I use other SDKs for selenium testing with ruby. I only need to be able to upload an image blob and attach it to sentry when an error is raised.

It's possible in other SDKs and I imagine that the requirement to upload attachments covers a vast array of possible uses beyond mine alone.

I already save the image blob to file when an error is caught, but it would be a lot easier to trace issues if the ruby SDK supported attachments like your other SDKS.

kornate avatar Sep 03 '21 15:09 kornate

I can understand your use case of this feature but it's also the only one I've received at the moment. And given that it's primarily for test environment use, I don't plan to implement this feature just for it. I'm afraid that I'll need some other use cases (particularly production ones) before implementing this.

st0012 avatar Sep 03 '21 15:09 st0012

We're in a concrete situation now where being able to upload file attachments to issues would be really handy.

Our use case is that users can upload CSV files. Those sometimes are not parsable. In those situations it's crucial to have access to the uploaded CSV file (normally we don't store them) in the issue context to debug the problem.

Jcambass avatar Jan 14 '22 06:01 Jcambass

@Jcambass Thanks for the feedback. That sounds a good use case for me.

@sl0thentr0py Do you think the file attachment feature is suitable for the above case? If it is, do you have any suggestion on how should we proceed this?

st0012 avatar Jan 15 '22 16:01 st0012

Hey @st0012, cool coincidence. We were actually just talking about this yesterday in our Q1 planning. We plan to roll out proper attachments support for both ruby and python this quarter, so I will likely work on adding it next month approximately.

cc @vladanpaunovic @smeubank a real use-case for attachments :)

sl0thentr0py avatar Jan 15 '22 17:01 sl0thentr0py

@sl0thentr0py Wow that sounds great! I just assigned this task to you then 😄

st0012 avatar Jan 15 '22 17:01 st0012

Any news on when this might come to sentry ruby ? We're in the same situation as @Jcambass and thinking we might just have to end up uploading the file ourselves to aws then adding a link using set_extras and finally have someone with access download the file... Which is just tedious to be honest

jwoodrow avatar Apr 13 '23 13:04 jwoodrow

Another use-case we ran into today.

We're parsing PDFs in a Ruby backend, and sometimes those PDFs are broken.

With a lot of work we can dig them out from another system, but being able to upload them as attachments to Sentry would speed up the troubleshooting (make it quicker to reproduce the bug on a developer machine).

sandstrom avatar Sep 14 '23 09:09 sandstrom

Thanks for the datapoint here.

hubertdeng123 avatar Sep 26 '23 19:09 hubertdeng123

Just checking in, are there any plans to bring this SDK to parity with the others, when it comes to attachment support?

Would be awesome! 😄

sandstrom avatar Jan 31 '24 10:01 sandstrom

hey no timeline yet but I'll try to add it soon

sl0thentr0py avatar Feb 06 '24 20:02 sl0thentr0py

Adding another datapoint here: we do custom integrations for our customers across various systems using browser automation (in our case, playwright-ruby-client). These are often across legacy systems that have no API or at least no publicly-facing API. Browser automation works, but we run into errors when pages take too long to load or if an unexpected modal pops up when trying to click on a button (just two examples among many). Playwright provides screenshot support and we're logging these errors to sentry, so it would be really nice to correlate the two but logging an error and attaching the screenshot that preceded the error.

jerhinesmith avatar Mar 06 '24 17:03 jerhinesmith

Another usecase: we have jobs working on non-small JSON documents, and it would be very useful to us to be able to attach those documents to the errors when the parsing or processing fails

renchap avatar Apr 05 '24 16:04 renchap

I'll second @renchap 's use case - we sometimes get invalid large JSON documents and I want to be able to report these in Sentry as attachments so we try and understand why they are invalid and therefore what might be causing them to be invalid.

It looks like this has been missing from the Ruby SDK for 3 years?

This page https://docs.sentry.io/platforms/ruby/crons/troubleshooting/ suggests that you can use the API to upload attachments and links to https://docs.sentry.io/product/crons/getting-started/http/#check-in-attachment-optional - but this page doesn't have anything about attachments on it.

jbarber avatar Apr 29 '24 10:04 jbarber