Skip to content

Commit 911b147

Browse files
committed
fix rest of aws lambda exports
1 parent b18c513 commit 911b147

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as Sentry from './index';
1+
import { init, tryPatchHandler } from './awslambda';
22

33
const lambdaTaskRoot = process.env.LAMBDA_TASK_ROOT;
44
if (lambdaTaskRoot) {
@@ -7,11 +7,11 @@ if (lambdaTaskRoot) {
77
throw Error(`LAMBDA_TASK_ROOT is non-empty(${lambdaTaskRoot}) but _HANDLER is not set`);
88
}
99

10-
Sentry.AWSLambda.init({
10+
init({
1111
_invokedByLambdaLayer: true,
1212
});
1313

14-
Sentry.AWSLambda.tryPatchHandler(lambdaTaskRoot, handlerString);
14+
tryPatchHandler(lambdaTaskRoot, handlerString);
1515
} else {
1616
throw Error('LAMBDA_TASK_ROOT environment variable is not set');
1717
}

packages/serverless/src/awslambda.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ import { awsServicesIntegration } from './awsservices';
2626
import { DEBUG_BUILD } from './debug-build';
2727
import { markEventUnhandled } from './utils';
2828

29-
export * from '@sentry/node';
30-
3129
const { isPromise } = types;
3230

3331
// https://www.npmjs.com/package/aws-lambda-consumer
@@ -37,7 +35,7 @@ type SyncHandler<T extends Handler> = (
3735
callback: Parameters<T>[2],
3836
) => void;
3937

40-
export type AsyncHandler<T extends Handler> = (
38+
type AsyncHandler<T extends Handler> = (
4139
event: Parameters<T>[0],
4240
context: Parameters<T>[1],
4341
) => Promise<NonNullable<Parameters<Parameters<T>[2]>[1]>>;
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
/** This file is used as the entrypoint for the lambda layer bundle, and is not included in the npm package. */
22

3-
// https://medium.com/unsplash/named-namespace-imports-7345212bbffb
4-
import * as AWSLambda from './awslambda';
5-
export { AWSLambda };
3+
import { init as awsLambdaInit, tryPatchHandler, wrapHandler } from './awslambda';
4+
5+
export const AWSLambda = {
6+
init: awsLambdaInit,
7+
wrapHandler,
8+
tryPatchHandler,
9+
};
610

711
export * from './awsservices';
812
export * from '@sentry/node';

packages/serverless/src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
export { awsServicesIntegration } from './awsservices';
2-
3-
import { init as awsLambdaInit, wrapHandler } from './awslambda';
2+
import { init as awsLambdaInit, tryPatchHandler, wrapHandler } from './awslambda';
43
import { init as gcpFunctionInit } from './gcpfunction';
54

65
const AWSLambda = {
76
init: awsLambdaInit,
87
wrapHandler,
8+
tryPatchHandler,
99
};
1010

1111
const GCPFunction = {
@@ -14,6 +14,9 @@ const GCPFunction = {
1414

1515
export { AWSLambda, GCPFunction };
1616

17+
import type { WrapperOptions as AWSWrapperOptions } from './awslambda';
18+
export type { AWSWrapperOptions };
19+
1720
// TODO(v8): We have to explicitly export these because of the namespace exports
1821
// above. This is because just doing `export * from '@sentry/node'` will not
1922
// work with Node native esm while we also have namespace exports in a package.

0 commit comments

Comments
 (0)