Skip to content

Commit 452bcae

Browse files
authored
fix(node): Allow use of NodeClient without calling init (#11585)
This needs exporting so that the `NodeClient` can be used without calling the Node `init`. There is a lot called in the Node init that is a hard requirement for the `NodeClient` to function. Should these not be called in the constructor?
1 parent ee4091e commit 452bcae

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

dev-packages/e2e-tests/test-applications/node-exports-test-app/scripts/consistentExports.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const NODE_EXPORTS_IGNORE = [
1414
'default',
1515
// Probably generated by transpilation, no need to require it
1616
'__esModule',
17+
// Only required from the Node package
18+
'setNodeAsyncContextStrategy',
1719
];
1820

1921
const nodeExports = Object.keys(SentryNode).filter(e => !NODE_EXPORTS_IGNORE.includes(e));

packages/node/src/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ export type { NodeOptions } from './types';
3737

3838
export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData } from '@sentry/utils';
3939

40-
// These are custom variants that need to be used instead of the core one
41-
// As they have slightly different implementations
42-
export { continueTrace } from '@sentry/opentelemetry';
40+
export {
41+
// These are custom variants that need to be used instead of the core one
42+
// As they have slightly different implementations
43+
continueTrace,
44+
// This needs exporting so the NodeClient can be used without calling init
45+
setOpenTelemetryContextAsyncContextStrategy as setNodeAsyncContextStrategy,
46+
} from '@sentry/opentelemetry';
4347

4448
export {
4549
addBreadcrumb,

0 commit comments

Comments
 (0)