You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sentry.wrapRemixHandleError missing request information #10002
I do not see any of these internals defined as I debug this, so this function always returns undefined symbols and Remix fails to normalize the request:
I wonder why Sentry needs to do this conversion instead of reading the standard Request directly to get the information as needed?
@onurtemizkan I took a second look at this. It seems the code relies on Remix's polyfill for NodeJS's fetch API. The internals like bodyInternalsSymbol and requestInternalsSymbol are available upon installing Remix's polyfill, like so:
import { installGlobals } from "@remix-run/node";
installGlobals();
However, this polyfill should not be needed, starting on NodeJS v18 which includes the Fetch API enabled by default. I do not use it in my app (which runs on Node v20). Sentry should not read Remix internals either. A backward-compatible, future-proof solution is to read from the standard request directly.
This implementation can be modified to read from request using the standard interface. The request's URL is available via request.url. The header are available via request.headers.
Activity
clovis1122 commentedon Jan 1, 2024
I spent some time debugging this locally and think it may be related to this code:
sentry-javascript/packages/remix/src/utils/web-fetch.ts
Lines 34 to 47 in 679e149
I do not see any of these internals defined as I debug this, so this function always returns undefined symbols and Remix fails to normalize the request:
I wonder why Sentry needs to do this conversion instead of reading the standard
Requestdirectly to get the information as needed?onurtemizkan commentedon Jan 2, 2024
Hi @clovis1122, thanks for reporting.
I have tried to reproduce this locally with the latest SDK and Remix 2.4.1 and did not see any problems with the request data getting attached.
We are replicating the behaviour of Remix (web-fetch) while extracting information from requests for consistency.
Could you please provide us a reproduction so we can debug it further?
clovis1122 commentedon Jan 14, 2024
@onurtemizkan I took a second look at this. It seems the code relies on Remix's polyfill for NodeJS's fetch API. The
internalslikebodyInternalsSymbolandrequestInternalsSymbolare available upon installing Remix's polyfill, like so:However, this polyfill should not be needed, starting on NodeJS v18 which includes the Fetch API enabled by default. I do not use it in my app (which runs on Node v20). Sentry should not read Remix internals either. A backward-compatible, future-proof solution is to read from the standard request directly.
sentry-javascript/packages/remix/src/utils/web-fetch.ts
Line 70 in 679e149
This implementation can be modified to read from request using the standard interface. The request's URL is available via
request.url. The header are available viarequest.headers.onurtemizkan commentedon Jan 14, 2024
@clovis1122, I opened a PR which adds support for non-polyfilled
fetchrequest objects. #10166Which will hopefully resolve this issue.
Thanks again for reporting.
fix(remix): Capture thrown fetch responses. (#10166)