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

Sentry returns 400 with the "premature end of input at line x column y" response #8739

Closed
3 tasks done
YusufZiya opened this issue Aug 7, 2023 · 6 comments
Closed
3 tasks done

Comments

@YusufZiya
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/react

SDK Version

7.61.0

Framework Version

React 18.2.0

Link to Sentry event

No response

SDK Setup

Sentry.init({
dsn: "MY_DSN",
maxBreadcrumbs: 50,
debug: true,
});

Steps to Reproduce

I tried to integrate sentry to my existing react project which is generated via CRA. I added a button click handler in order to generate an error.

const foo = {};
foo.bar();

Sentry caught the error but when it sent to the server it responded like that.

{
"detail": "invalid event envelope",
"causes": [
"invalid envelope header",
"premature end of input at line 1 column 82"
]
}

Expected Result

Return 200

Actual Result

Http status code: 400

Response:

{
"detail": "invalid event envelope",
"causes": [
"invalid envelope header",
"premature end of input at line 1 column 82"
]
}

@lforst
Copy link
Member

lforst commented Aug 7, 2023

Hi, can you share the payload that was attempted to be sent? Thanks!

@YusufZiya
Copy link
Author

Request Payload:

{"event_id":"f782814af21d4b3abe25868755c87ba4","sent_at":"2023-08-04T10:39:01.445","sdk":{"name":"sentry.javascript.react","version":"7.61.0"},"trace":{"environment":"production","public_key":"MY_PUBLIC_KEY","trace_id":"2557cd1435ad48899a70f6231bede4c9"}}
{"type":"event"}
{"exception":{"values":[{"type":"TypeError","value":"foo.bar is not a function","stacktrace":{"frames":[{"filename":"http://localhost:23235/cdn-bundles/fed.base.js?cache-disabled=false","function":"Aj","in_app":true,"lineno":78,"colno":351},{"filename":"http://localhost:23235/cdn-bundles/fed.base.js?cache-disabled=false","function":"Be","in_app":true,"lineno":79,"colno":62},{"filename":"http://localhost:23235/cdn-bundles/fed.base.js?cache-disabled=false","function":"Ce","in_app":true,"lineno":97,"colno":218},{"filename":"http://localhost:23235/cdn-bundles/fed.base.js?cache-disabled=false","function":"wg","in_app":true,"lineno":64,"colno":481},{"filename":"http://localhost:23235/cdn-bundles/fed.base.js?cache-disabled=false","function":"Tf","in_app":true,"lineno":221,"colno":448},{"filename":"http://localhost:23235/cdn-bundles/fed.base.js?cache-disabled=false","function":"?","in_app":true,"lineno":104,"colno":332},{"filename":"http://localhost:23235/cdn-bundles/fed.base.js?cache-disabled=false","function":"Xg","in_app":true,"lineno":95,"colno":1},{"filename":"http://localhost:23235/cdn-bundles/fed.base.js?cache-disabled=false","function":"gh","in_app":true,"lineno":94,"colno":93},{"filename":"http://localhost:23235/cdn-bundles/fed.base.js?cache-disabled=false","function":"nj","in_app":true,"lineno":66,"colno":171},{"filename":"http://localhost:23235/cdn-bundles/fed.base.js?cache-disabled=false","function":"kj","in_app":true,"lineno":66,"colno":117},{"filename":"http://localhost:23235/cdn-bundles/fed.base.js?cache-disabled=false","function":"Object.lj","in_app":true,"lineno":255,"colno":217},{"filename":"http://localhost:3000/static/js/main.bundle.js","function":"NewCustomerButton._this.onClick","in_app":true,"lineno":296256,"colno":67},{"filename":"http://localhost:3000/static/js/main.bundle.js","function":"Object.onClick","in_app":true,"lineno":297674,"colno":25},{"filename":"http://localhost:3000/static/js/main.bundle.js","function":"HeaderBarTop.handleAsd","in_app":true,"lineno":297644,"colno":11}]},"mechanism":{"type":"instrument","handled":true,"data":{"function":"addEventListener","handler":"bound Aj","target":"EventTarget"}}}]},"level":"error","event_id":"f782814af21d4b3abe25868755c87ba4","platform":"javascript","timestamp":1691134741.438,"environment":"production","sdk":{"integrations":["InboundFilters","FunctionToString","TryCatch","Breadcrumbs","GlobalHandlers","LinkedErrors","Dedupe","HttpContext"],"name":"sentry.javascript.react","version":"7.61.0","packages":[{"name":"npm:@sentry/react","version":"7.61.0"}]},"breadcrumbs":[{"timestamp":1691134703.962,"category":"fetch","data":{"method":"GET","url":"http://localhost:6001/api/v1/uygulama-altyapi/cache-altyapilari/arabellekverileri/SUBELER","status_code":200},"type":"http"},{"timestamp":1691134703.964,"category":"fetch","data":{"method":"GET","url":"http://localhost:6001/api/v1/uygulama-altyapi/cache-altyapilari/arabellekverileri/EFT_SUBELER","status_code":200},"type":"http"},{"timestamp":1691134704.102,"category":"fetch","data":{"method":"POST","url":"http://localhost:6001/api/v1/uygulama-altyapi/guvenlik-altyapisi/finartkullanicioturumpozisyonlari","status_code":200},"type":"http"},{"timestamp":1691134704.166,"category":"fetch","data":{"method":"GET","url":"http://localhost:6001/api/v1/uygulama-altyapi/cache-altyapilari/arabellekverileri/DYNAMICVALUES","status_code":200},"type":"http"},{"timestamp":1691134704.843,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/common-hcz/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134704.844,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/reporting-client/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134704.844,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/call-center-client/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134705.228,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/business-forms/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134705.236,"category":"fetch","data":{"method":"GET","url":"http://localhost:6001/api/v1/uygulama-altyapi/guvenlik-altyapisi/kullaniciekranyetkiislemleri?filter={"kullaniciKod":"HAKARLAR","screenId":"SOSM360G","metroMenuTanımı":false,"disableUpdateScreenStatistic":true}","status_code":200},"type":"http"},{"timestamp":1691134705.236,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/business-common/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134705.237,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/base-components/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134705.674,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/uDisardanErisilenFormlar/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134705.683,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/opc-session/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134705.687,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/cZorunluBilgi/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134705.761,"category":"fetch","data":{"method":"GET","url":"http://localhost:6001/api/v1/uygulama-altyapi/cache-altyapilari/arabellekverileri/MESAJLAR","status_code":200},"type":"http"},{"timestamp":1691134705.763,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/zt-session-router/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134705.764,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/cVKNDogrulama/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134706.556,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/cMusteriUrun/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134706.605,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/common-mvt/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134706.61,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/common-eft/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134706.613,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/ex-stacktrace-js/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134706.614,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/fis-dokuman/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134706.614,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/cTalimatVekalet/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134706.76,"category":"fetch","data":{"method":"GET","url":"http://localhost:6001/api/v1/uygulama-altyapi/guvenlik-altyapisi/kullaniciekranyetkiislemleri?filter={"kullaniciKod":"HAKARLAR","screenId":"SOSMMASA","metroMenuTanımı":false,"disableUpdateScreenStatistic":true}","status_code":200},"type":"http"},{"timestamp":1691134706.948,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/scanner-client/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134706.948,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/cKimlik/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134706.948,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/oc-utils/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134706.992,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/ex-react-luckysheet/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134707.113,"category":"fetch","data":{"method":"POST","url":"http://localhost:6001/api/v1/uygulama-altyapi/frame/zfugirisbilgileri","status_code":200},"type":"http"},{"timestamp":1691134707.617,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/imaging-client/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134707.618,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/common-ecm/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134707.62,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/cImageViewer/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134707.622,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/common-mas-masrafbilgi/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134707.623,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/common-hzn/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134707.791,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/common-eft-merkezbankasi/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134707.908,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/cDocumentTree/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134707.91,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/rprguide-app/dependencies.json?cache-disabled=false","status_code":404},"type":"http"},{"timestamp":1691134708.264,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/cImageCrop/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134708.267,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/ex-file-type/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134708.402,"category":"fetch","data":{"method":"GET","url":"http://localhost:3000/dependencies.json","status_code":200},"type":"http"},{"timestamp":1691134708.58,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/cImageDocumentViewer/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134708.884,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/fed-zfu-adapter/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134708.99,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/iframe-utils/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134708.99,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/uKlavuzFiyatlama/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134708.991,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/uKilavuzAnalitik/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134709.014,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/uKlavuz/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134709.359,"category":"fetch","data":{"method":"GET","url":"http://localhost:23235/ex-react-pdf/dependencies.json?cache-disabled=false","status_code":200},"type":"http"},{"timestamp":1691134717.267,"category":"console","data":{"arguments":["G2 tracks nothing ;-)"],"logger":"console"},"level":"warning","message":"G2 tracks nothing ;-)"},{"timestamp":1691134718.101,"category":"console","data":{"arguments":["Component registration on window completed for cSube"],"logger":"console"},"level":"info","message":"Component registration on window completed for cSube"},{"timestamp":1691134741.429,"category":"ui.click","message":"div.addNewCustomerWrapper > span.addNewCustomer > i.fas.fa-user-plus"}],"request":{"url":"http://localhost:3000/home","headers":{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"}},"extra":{"arguments":[{"type":"click","target":"div.addNewCustomerWrapper > span.addNewCustomer > i.fas.fa-user-plus","currentTarget":" > html.hydrated > body > div#root","isTrusted":true}]},"contexts":{"trace":{"trace_id":"2557cd1435ad48899a70f6231bede4c9","span_id":"b57d46339583f23b"}}}

Thanks.

@lforst
Copy link
Member

lforst commented Aug 7, 2023

Ok seems like there is a Z missing at the end of the sent_at timestamp in the envelope header. We'll investigate.

@lforst
Copy link
Member

lforst commented Aug 7, 2023

Date.toISOString() which we use to generate this string always has a Z at the end. Are you using any library that might be modifying the time methods?

I have a feeling that this is not on the SDK since many many people would report this and we would be missing a lot of events.

@YusufZiya
Copy link
Author

Hello, thanks for your investigation.

We override the toISOString method to return "YYYY-MM-DDTHH:mm:ss.SSS" and many teams in our company use this method. So we can't take it back. :(
Is there any chance to change the "sent_at" field before sentry send the events? Or do you have any advice to solve this problem?

Thanks :)

@lforst
Copy link
Member

lforst commented Aug 8, 2023

@YusufZiya since Date.toISOString() is a built-in method, I think it is fair for the SDK to assume it works as expected. Theoretically, there is a beforeEnvelope hook you can use but it's a pretty internal API and not documented very well. Other than that there is no way I believe.

I also don't think it is worth it for us to add a way to configure the sent_at field, which is why I am gonna close this issue. Feel free to reach out if you have more questions!

@lforst lforst closed this as not planned Won't fix, can't repro, duplicate, stale Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants