Skip to content

Commit 8bc1613

Browse files
committed
ref: avoid duplicate import?
1 parent 449e3d7 commit 8bc1613

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

packages/serverless/src/awslambda.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import { hostname } from 'os';
33
import { basename, resolve } from 'path';
44
import { types } from 'util';
55
/* eslint-disable max-lines */
6-
import type { Scope } from '@sentry/node';
7-
import * as Sentry from '@sentry/node';
6+
import { NodeOptions, SDK_VERSION, Scope } from '@sentry/node';
87
import {
98
captureException,
109
captureMessage,
1110
continueTrace,
11+
defaultIntegrations as nodeDefaultIntegrations,
1212
flush,
1313
getCurrentScope,
14+
init as initNode,
1415
startSpanManual,
1516
withScope,
1617
} from '@sentry/node';
@@ -63,9 +64,9 @@ export interface WrapperOptions {
6364
startTrace: boolean;
6465
}
6566

66-
export const defaultIntegrations: Integration[] = [...Sentry.defaultIntegrations, new AWSServices({ optional: true })];
67+
export const defaultIntegrations: Integration[] = [...nodeDefaultIntegrations, new AWSServices({ optional: true })];
6768

68-
interface AWSLambdaOptions extends Sentry.NodeOptions {
69+
interface AWSLambdaOptions extends NodeOptions {
6970
/**
7071
* Internal field that is set to `true` when init() is called by the Sentry AWS Lambda layer.
7172
*
@@ -74,7 +75,7 @@ interface AWSLambdaOptions extends Sentry.NodeOptions {
7475
}
7576

7677
/**
77-
* @see {@link Sentry.init}
78+
* @see {@link init}
7879
*/
7980
export function init(options: AWSLambdaOptions = {}): void {
8081
const opts = {
@@ -89,13 +90,13 @@ export function init(options: AWSLambdaOptions = {}): void {
8990
packages: [
9091
{
9192
name: 'npm:@sentry/serverless',
92-
version: Sentry.SDK_VERSION,
93+
version: SDK_VERSION,
9394
},
9495
],
95-
version: Sentry.SDK_VERSION,
96+
version: SDK_VERSION,
9697
};
9798

98-
Sentry.init(opts);
99+
initNode(opts);
99100
}
100101

101102
/** */

0 commit comments

Comments
 (0)