sentry-javascript
sentry-javascript copied to clipboard
NodeJS local variable workaround doesn't work in Remix app
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 SDK are you using?
@sentry/remix
SDK Version
7.90.0
Framework Version
Remix 2.4.0
Link to Sentry event
https://netscout-cct.sentry.io/issues/4743090472/events/16f0b72e440549c38e81fdb010667ae5/
SDK Setup
import * as SentryRemix from "@sentry/remix";
import { AWSLambda as SentryLambda } from "@sentry/serverless";
const commonOptions = {
tracesSampleRate: 1,
includeLocalVariables: true,
attachStacktrace: true,
};
SentryRemix.init({
...commonOptions,
integrations: [
new SentryRemix.Integrations.LocalVariables({
captureAllExceptions: true,
}),
],
});
SentryLambda.init(commonOptions);
export const handler = SentryLambda.wrapHandler(handler);
Steps to Reproduce
Follow steps here: https://github.com/brettdh/sentry-remix-lambda-esm-variables
Expected Result
One of these:
- Stack trace with local variables with default Remix setup; or
- The ability to enable the workaround via the Remix SDK API (
Sentry.captureRemixServerException)
Actual Result
-
With default setup, stack trace does not have locals
- Er, whoops, apparently it does, but not in all stack frames:
- Er, whoops, apparently it does, but not in all stack frames:
-
No way to use
Sentry.captureRemixServerExceptionto apply the workaround
@timfish I don't remember is it is expected behaviour that the local variables are only captured for the top frame?
We capture local variables for the top 5 frames only for now:
https://github.com/getsentry/sentry-javascript/blob/12a4fce26a3ae38741dae9c5c0f7e2290f40133e/packages/node/src/integrations/localvariables.ts#L430-L432
It might be worth us trying the inspector experimental promises API (Node v19+) where available to negate the stack overflow risks.
@timfish Hmm. Two things about that:
- I didn't notice it in the documentation for the workaround
- The example issue I linked only has three frames with locals, and only two frames have locals captured
Sorry I'm not sure what you mean by "the workaround", can you link me some context?
Sure, sorry for the accidental shorthand. I'm referring to the workaround mentioned in the Local Variables section of the NodeJS default integrations doc.
There have been a lot of improvements and changes to the local variables integration for v8. On later versions of node the debugger is run in a worker thread and there are no limits to the number of frames we lookup.
Could someone try v8.0.0-rc.1 and see if the issues are resolved?
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 🥀