Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions apps/web/__tests__/unit/sentry-server-propagation.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { beforeEach, describe, expect, it, vi } from "vitest";

const init = vi.hoisted(() => vi.fn());
vi.mock("@sentry/nextjs", () => ({ init }));

describe("server Sentry setup", () => {
beforeEach(() => {
init.mockReset();
vi.resetModules();
vi.stubEnv(
"NEXT_PUBLIC_SENTRY_DSN",
"https://public@example.ingest.sentry.io/1",
);
});

it.each([
["node", "../../sentry.server.config"],
["edge", "../../sentry.edge.config"],
])(
"adds no trace headers to outgoing requests on the %s runtime",
async (_runtime, path) => {
await import(path);
expect(init).toHaveBeenCalledTimes(1);
const options = init.mock.calls[0]?.[0];
expect(options.tracePropagationTargets).toEqual([]);
expect(options.tracesSampleRate).toBe(0);
},
);
});
3 changes: 3 additions & 0 deletions apps/web/sentry.edge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ if (dsn) {
dsn,
sendDefaultPii: false,
tracesSampleRate: 0,
// Tracing is off, so the trace headers serve nothing on outgoing
// requests, and some of those go to customers' own servers.
tracePropagationTargets: [],
maxBreadcrumbs: 30,
});
}
3 changes: 3 additions & 0 deletions apps/web/sentry.server.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ if (dsn) {
dsn,
sendDefaultPii: false,
tracesSampleRate: 0,
// Tracing is off, so the trace headers serve nothing on outgoing
// requests, and some of those go to customers' own servers.
tracePropagationTargets: [],
maxBreadcrumbs: 30,
});
}
Loading