Comments (4)
Fair point. If the SDK can already predict that the envelope will be rejected due to size it should not simply attempt to send it.
I'm not sure where the attached file comes from? Are you capturing the exception manually?
from sentry-dotnet.
Correct - I am capturing the exception manually.
Here is a minimal reproduction snippet of code:
[HttpPost]
public async Task<IActionResult> Upload([FromForm] IFormFileCollection file)
{
try
{
throw new Exception();
}
catch (Exception e)
{
SentrySdk.CaptureException(e);
}
return Ok();
}
from sentry-dotnet.
Correct - I am capturing the exception manually.
Here is a minimal reproduction snippet of code:
[HttpPost] public async Task<IActionResult> Upload([FromForm] IFormFileCollection file) { try { throw new Exception(); } catch (Exception e) { SentrySdk.CaptureException(e); } return Ok(); }
@bitsandfoxes To add to this (I'm on the same team), we are utilizing the overload of the CaptureException
method to configure the local scope on the fly and its where we are attaching the file, like so:
// Create attachment from uploaded file
var attachment = new Attachment(AttachmentType.Default, new StreamAttachmentContent(uploadedFileStream),
file.FileName, file.ContentType);
// Add attachment to Sentry
scope.AddAttachment(attachment);
We can work around the envelope exceeded limits by attaching a custom event processor as well, which strips the file from the request body, but if we do not do this, it might be useful for the SentrySdk
to be a little more specific on the why the envelope was rejected, e.g. a multipart/form-data
file was detected that exceeds the permitted file size limit.
Additionally, the attachment flow I outlined above does not seem to work - even though we attached the attachment in what looks to be the correct manner, it is still not visible in Sentry on web. Any pointers?
from sentry-dotnet.
This starts to sound like multiple issues.
I'll bring "hitting size limits" up with the team. It seems like a recurring thing that we can definitely improve.
A workaround for this issue would be to set a method in
SetBeforeSend
that omits theRequest.Data
in case of file uploads.
You could rely on the hint
object that gets passed to the SetBeforeSend
callback instead of adding your own eventprocessor. The hint holds the attachments
as a list and if you remove an attachment there it won't be sent with the event.
Additionally, the attachment flow I outlined above does not seem to work - even though we attached the attachment in what looks to be the correct manner, it is still not visible in Sentry on web. Any pointers?
Without having access to any logs it's a bit hard to tell. But you're right. It appears to be the correct manner. The only thing that comes to mind would be that since you're adding the attachment as a stream, during the upload that stream has been closed/disposed, causing the SDK to fail internally which would not be reported.
from sentry-dotnet.
Related Issues (20)
- NativeAOT iOS transactions crash the app HOT 3
- Native iOS/Cocoa options naming - 4.0.0-beta.3 HOT 4
- Move LogCat prop to SentryOptions
- Set ip_address to {{auto}} by default, even if sendDefaultPII is disabled HOT 1
- Add In Foreground to App context HOT 4
- SDK Backpressure and 100% Sampling
- Log4Net integration should filter SDK logs
- MAUI MacCatalyst Apps have a `default.profraw` generated inside the .app bundle when the app exits HOT 17
- Spotlight support
- Failed to extract body. HOT 2
- The `Hub` should resolve the SentryClient in a consistent way
- Add Distributed Tracing to the ASP.NET Core Documentation HOT 1
- Ui Component Crash When Sentry is Initialized HOT 2
- Send frame `filename` including project root HOT 1
- Sentry ASP.NET Core configuration issue with Serilog HOT 2
- Device tests in CI should have diagnostic logging in output or attachment
- consolidate exception position in logger callbacks
- NoMobile sln including mobile targets HOT 6
- Replace SdkVersion from reflection to source generator
- No line numbers in local development HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentry-dotnet.