Skip to content

Commit

Permalink
ref(node): Make RequestData integration default (#5980)
Browse files Browse the repository at this point in the history
This adds the new `RequestData` integration to the node SDK's default integrations, in order to be able to use it in SDKs besides just nextjs. (It therefore also removes it from the nextjs SDK's specific defaults.) In cases where we haven't yet set up our request handlers to use the integration, the event processor it adds will no-op because it won't find a request object in `sdkProcessingMetadata`.
  • Loading branch information
lobsterkatie committed Oct 19, 2022
1 parent c1d9c66 commit b34a37b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions packages/nextjs/src/index.server.ts
Expand Up @@ -118,9 +118,6 @@ function addServerIntegrations(options: NextjsOptions): void {
});
integrations = addOrUpdateIntegration(defaultRewriteFramesIntegration, integrations);

const defaultRequestDataIntegration = new Integrations.RequestData();
integrations = addOrUpdateIntegration(defaultRequestDataIntegration, integrations);

if (hasTracingEnabled(options)) {
const defaultHttpTracingIntegration = new Integrations.Http({ tracing: true });
integrations = addOrUpdateIntegration(defaultHttpTracingIntegration, integrations, {
Expand Down
2 changes: 0 additions & 2 deletions packages/nextjs/test/index.server.test.ts
Expand Up @@ -148,10 +148,8 @@ describe('Server init()', () => {

const nodeInitOptions = nodeInit.mock.calls[0][0] as ModifiedInitOptions;
const rewriteFramesIntegration = findIntegrationByName(nodeInitOptions.integrations, 'RewriteFrames');
const requestDataIntegration = findIntegrationByName(nodeInitOptions.integrations, 'RequestData');

expect(rewriteFramesIntegration).toBeDefined();
expect(requestDataIntegration).toBeDefined();
});

it('supports passing unrelated integrations through options', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/node/src/sdk.ts
Expand Up @@ -27,6 +27,7 @@ import {
Modules,
OnUncaughtException,
OnUnhandledRejection,
RequestData,
} from './integrations';
import { getModule } from './module';
import { makeNodeTransport } from './transports';
Expand All @@ -46,6 +47,7 @@ export const defaultIntegrations = [
new ContextLines(),
new Context(),
new Modules(),
new RequestData(),
// Misc
new LinkedErrors(),
];
Expand Down

0 comments on commit b34a37b

Please sign in to comment.