-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- 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/remix
SDK Version
7.21.1
Framework Version
1.4.3
Link to Sentry event
No response
Steps to Reproduce
I have setup Sentry Remix SDK as shown in the guide.
This is my Express.js config:
// near the top of the file
let dsn = process.env.FRONTEND_SENTRY_DSN;
const createSentryRequestHandler = dsn
? wrapExpressCreateRequestHandler(createRequestHandler)
: createRequestHandler;
// inside `server.all("*")`
return createSentryRequestHandler({ build: require("./build"), mode: env })(
req,
res,
next
);In my entry.server.tsx I setup Sentry this way:
import * as Sentry from "@sentry/remix";
// this is outside the handleRequest function but I tried inside too
if (process.env.FRONTEND_SENTRY_DSN) {
Sentry.init({
dsn: process.env.FRONTEND_SENTRY_DSN,
tracesSampleRate: 1,
integrations: [],
attachStacktrace: true,
debug: process.env.NODE_ENV === "development",
});
}And in entry.client.tsx, before I hydrate my Remix app
if (process.env.FRONTEND_SENTRY_DSN) {
Sentry.init({
dsn: process.env.FRONTEND_SENTRY_DSN,
tracesSampleRate: 1,
integrations: [
new Sentry.BrowserTracing({
routingInstrumentation: Sentry.remixRouterInstrumentation(
useEffect,
useLocation,
useMatches
),
}),
],
attachStacktrace: true,
debug: process.env.NODE_ENV === "development",
});
}I'm using the same version of Remix installed as devDependency in the SDK source code
sentry-javascript/packages/remix/package.json
Lines 36 to 37 in f1e59f9
| "@remix-run/node": "^1.4.3", | |
| "@remix-run/react": "^1.4.3", |
And I'm using Node v16 (also tried v18) which match the supported engines
sentry-javascript/packages/remix/package.json
Lines 12 to 14 in f1e59f9
| "engines": { | |
| "node": ">=14" | |
| }, |
Expected Result
It should render my app and work correctly.
Actual Result
I get a white screen with black text with this error
TypeError: headers[Symbol.for(...)] is not a function
at Object.normalizeRemixRequest (/Users/[REDACTED]/node_modules/@sentry/src/utils/web-fetch.ts:117:1)
at /Users/[REDACTED]/node_modules/@sentry/src/utils/instrumentServer.ts:379:1
at bound (node:domain:433:15)
at runBound (node:domain:444:12)
at /Users/[REDACTED]/node_modules/@sentry/src/utils/instrumentServer.ts:408:1
at /Users/[REDACTED]/frontend/node_modules/@remix-run/express/server.js:41:28
at remixHandler (/Users/[REDACTED]/server/index.js:104:78)
at Layer.handle [as handle_request] (/Users/[REDACTED]/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/[REDACTED]/node_modules/express/lib/router/route.js:137:13)
at next (/Users/[REDACTED]/node_modules/express/lib/router/route.js:131:14)
From the stacktrace, and after trying to debug it in node_modules, the error is happening on this exact line
| headers: headers[Symbol.for('nodejs.util.inspect.custom')](), |
Symbol.for('nodejs.util.inspect.custom') is not a key in headers.
If I replace the line with just headers: headers (or just headers) my app renders correctly and when I throw an error it's reported to Sentry too, so I'm not sure what that line does, and from the comment who coded it doesn't know too 😅