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

When the fetch request fails, the reason value obtained by the onunhandlerejection event is the Response instance. At this time, the uploaded data is' [object response] '. Is this normal? I prefer to get specific response data

Open yuanman0109 opened this issue 3 years ago • 6 comments

Is there an existing issue for this?

  • [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [X] I have reviewed the documentation https://docs.sentry.io/
  • [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/browser

SDK Version

7.27.0

Framework Version

No response

Link to Sentry event

No response

Steps to Reproduce

window.dispatchEvent( new CustomEvent('unhandledrejection', { detail: { promise: new Promise(function () {}), reason: new Response({ code : 401, data: '' }), }, }) ); When the browser console executes the above code, an unhandlerejection error will be triggered. However, since the value of exception is' [object response] ', such information has no value. We cannot locate the error.

Expected Result

I hope to get the data in the response, Whether the data in the object can be converted to json string

Actual Result

image image

yuanman0109 avatar Dec 20 '22 10:12 yuanman0109

Hi @yuanman0109 thanks for reporting! Backlogging this to investigate further and potentially fix. In the meantime, PRs are welcome ;)

Lms24 avatar Dec 21 '22 08:12 Lms24

Hi @yuanman0109 thanks for reporting! Backlogging this to investigate further and potentially fix. In the meantime, PRs are welcome ;)

okey, I will continue to wait for your verification and update, thank you

yuanman0109 avatar Dec 23 '22 06:12 yuanman0109

你好@yuanman0109感谢您的报告!积压此以进一步调查并可能修复。同时,欢迎 PR ;)

image image

I have added a new type to deal with this problem.I don't know if it conforms to the specification

yuanman0109 avatar Jan 03 '23 03:01 yuanman0109

I am having this issue too, does anyone have any idea why?

varjmes avatar Jun 14 '23 13:06 varjmes

This is still on our backlog and we haven't had a chance to investigate this. Unfortunately we're completely swamped with other tasks. If anyone can provide a minimal reproduction example repository, that would be a great help. Also, PR's remain welcome :)

Lms24 avatar Aug 03 '23 09:08 Lms24

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar May 16 '24 07:05 getsantry[bot]