Skip to content

Commit a9d120e

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

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

packages/serverless/src/awslambda.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ 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 type { NodeOptions, Scope } from '@sentry/node';
7+
import { SDK_VERSION } from '@sentry/node';
88
import {
99
captureException,
1010
captureMessage,
1111
continueTrace,
12+
defaultIntegrations as nodeDefaultIntegrations,
1213
flush,
1314
getCurrentScope,
15+
init as initNode,
1416
startSpanManual,
1517
withScope,
1618
} from '@sentry/node';
@@ -63,9 +65,9 @@ export interface WrapperOptions {
6365
startTrace: boolean;
6466
}
6567

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

68-
interface AWSLambdaOptions extends Sentry.NodeOptions {
70+
interface AWSLambdaOptions extends NodeOptions {
6971
/**
7072
* Internal field that is set to `true` when init() is called by the Sentry AWS Lambda layer.
7173
*
@@ -74,7 +76,7 @@ interface AWSLambdaOptions extends Sentry.NodeOptions {
7476
}
7577

7678
/**
77-
* @see {@link Sentry.init}
79+
* @see {@link init}
7880
*/
7981
export function init(options: AWSLambdaOptions = {}): void {
8082
const opts = {
@@ -89,13 +91,13 @@ export function init(options: AWSLambdaOptions = {}): void {
8991
packages: [
9092
{
9193
name: 'npm:@sentry/serverless',
92-
version: Sentry.SDK_VERSION,
94+
version: SDK_VERSION,
9395
},
9496
],
95-
version: Sentry.SDK_VERSION,
97+
version: SDK_VERSION,
9698
};
9799

98-
Sentry.init(opts);
100+
initNode(opts);
99101
}
100102

101103
/** */

0 commit comments

Comments
 (0)