-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref(dev): Remove stacktrace limit on node errors in yarn scripts #5650
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
Conversation
Took a look at this, no idea why remix is erroring. Maybe @onurtemizkan may know? Maybe we can fix the remix test issues by lowering |
Looks like we were using the whole error with its stack trace as the event message on Remix server instrumentation. With this update, it created huge messages in breadcrumbs, which I think broke the Jest matchers. Also, due to the huge event messages, the expected orders of transactions / events have changed. So I had to filter / separate them to make sure they don't flake. So this diff below fixed the tests on my local. Diffdiff --git a/.yarnrc b/.yarnrc
index 19daacaa0..3b1ccde9c 100644
--- a/.yarnrc
+++ b/.yarnrc
@@ -1 +1,3 @@
workspaces-experimental true
+env:
+ NODE_OPTIONS --stack-trace-limit=100001
diff --git a/packages/remix/src/utils/instrumentServer.ts b/packages/remix/src/utils/instrumentServer.ts
index 04107fe07..7fffdad6e 100644
--- a/packages/remix/src/utils/instrumentServer.ts
+++ b/packages/remix/src/utils/instrumentServer.ts
@@ -68,7 +68,7 @@ function captureRemixServerException(err: Error, name: string): void {
return;
}
- captureException(isResponse(err) ? extractData(err) : err, scope => {
+ captureException(isResponse(err) ? extractData(err) : err.message, scope => {
scope.addEventProcessor(event => {
addExceptionMechanism(event, {
type: 'instrument',
diff --git a/packages/remix/test/integration/test/server/action.test.ts b/packages/remix/test/integration/test/server/action.test.ts
index b5a0dc082..65dc04220 100644
--- a/packages/remix/test/integration/test/server/action.test.ts
+++ b/packages/remix/test/integration/test/server/action.test.ts
@@ -37,13 +37,16 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
const env = await RemixTestEnv.init(adapter);
const url = `${env.url}/action-json-response/-1`;
- const [transaction, event] = await env.getMultipleEnvelopeRequest({
+ const envelopes = await env.getMultipleEnvelopeRequest({
url,
count: 2,
method: 'post',
envelopeType: ['transaction', 'event'],
});
+ const [transaction] = envelopes.filter(envelope => envelope[1].type === 'transaction');
+ const [event] = envelopes.filter(envelope => envelope[1].type === 'event');
+
assertSentryTransaction(transaction[2], {
contexts: {
trace: {
@@ -79,13 +82,16 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
const env = await RemixTestEnv.init(adapter);
const url = `${env.url}/action-json-response/-2`;
- const [transaction_1, event, transaction_2] = await env.getMultipleEnvelopeRequest({
+ const envelopes = await env.getMultipleEnvelopeRequest({
url,
count: 3,
method: 'post',
envelopeType: ['transaction', 'event'],
});
+ const [transaction_1, transaction_2] = envelopes.filter(envelope => envelope[1].type === 'transaction');
+ const [event] = envelopes.filter(envelope => envelope[1].type === 'event');
+
assertSentryTransaction(transaction_1[2], {
contexts: {
trace: {
diff --git a/packages/remix/test/integration/test/server/loader.test.ts b/packages/remix/test/integration/test/server/loader.test.ts
index 8d8b0b93c..fa6d88658 100644
--- a/packages/remix/test/integration/test/server/loader.test.ts
+++ b/packages/remix/test/integration/test/server/loader.test.ts
@@ -77,12 +77,15 @@ describe.each(['builtin', 'express'])('Remix API Loaders with adapter = %s', ada
const env = await RemixTestEnv.init(adapter);
const url = `${env.url}/loader-json-response/-1`;
- const [transaction_1, event, transaction_2] = await env.getMultipleEnvelopeRequest({
+ const envelopes = await env.getMultipleEnvelopeRequest({
url,
count: 3,
envelopeType: ['transaction', 'event'],
});
+ const [transaction_1, transaction_2] = envelopes.filter(envelope => envelope[1].type === 'transaction');
+ const [event] = envelopes.filter(envelope => envelope[1].type === 'event');
+
assertSentryTransaction(transaction_1[2], {
contexts: {
trace: {
Can open a PR if that makes sense? |
Thanks for looking into this, @onurtemizkan! I'll leave some comments on #5711. |
78c3775
to
005d2d0
Compare
size-limit report 📦
|
By default, Node errors only include the top 10 stackframes. Given the number of frames taken up by internal node code (especially when async functions are involved), this very often means that frames which might actually tell us something are cut off.
This solves that problem by removing the 10-frame limit for all errors thrown by node processes run through yarn. Note that this is a change which only affects our dev environment, not the SDK itself.