Skip to content
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

fix(remix): Skip capturing ok responses as errors. #5405

Merged
merged 2 commits into from Jul 11, 2022

Conversation

onurtemizkan
Copy link
Collaborator

@onurtemizkan onurtemizkan commented Jul 11, 2022

ref: #5362

Remix supports throwing responses from loader and action functions for its internal CatchBoundary.

They are catched on the caller level, but as we wrap the callees, they are registered as exceptions in the SDK. Being http responses, they end up like {size: 0}, which is not meaningful.

This PR skips exception capturing for responses that are not 4xx or 5xx.

function captureRemixServerException(err: Error, name: string): void {
// Skip capturing if the thrown error is a Response
// https://remix.run/docs/en/v1/api/conventions#throwing-responses-in-loaders
if (isResponse(err)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we still allow certain responses through? Like 500s? And then add the response data to the event also.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Maybe something like >=400?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that sounds reasonable.

@onurtemizkan onurtemizkan changed the title fix(remix): Skip capturing response errors. fix(remix): Skip capturing ok responses as errors. Jul 11, 2022
@AbhiPrasad AbhiPrasad merged commit ce67a38 into master Jul 11, 2022
@AbhiPrasad AbhiPrasad deleted the onur/skip-capturing-for-remix-responses branch July 11, 2022 17:50
lobsterkatie pushed a commit that referenced this pull request Jul 21, 2022
…ms. (#5429)

Fixes: #5423

Ref: #5405 

We were extracting the bodies of 4xx/5xx responses to capture, but Remix also uses them, we should not consume their `body` streams, as they are only available once in response lifespans. 

This PR updates `extractData` to work on a clone response.
lobsterkatie pushed a commit that referenced this pull request Jul 21, 2022
Fixes: #5425 

Ref: #5429, #5405 

As per review #5429 (comment), we need to define how and when we should capture a 4xx error.

We will only capture thrown 5xx responses until then.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants