Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(aws-serverless): Fix build of lambda layer #12083

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/aws-serverless/rollup.aws.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default [
sourcemap: false,
},
},
preserveModules: false,
}),
// We only need one copy of the SDK, and we pick the minified one because there's a cap on how big a lambda function
// plus its dependencies can be, and we might as well take up as little of that space as is necessary. We'll rename
Expand Down
9 changes: 4 additions & 5 deletions packages/aws-serverless/src/awslambda-auto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getDefaultIntegrations as getNodeDefaultIntegrations } from '@sentry/node';
import { init, tryPatchHandler } from './sdk';
import * as Sentry from './index';

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this back to how we imported the actual SDK in v7

const lambdaTaskRoot = process.env.LAMBDA_TASK_ROOT;
if (lambdaTaskRoot) {
Expand All @@ -8,12 +7,12 @@ if (lambdaTaskRoot) {
throw Error(`LAMBDA_TASK_ROOT is non-empty(${lambdaTaskRoot}) but _HANDLER is not set`);
}

init({
Sentry.init({
// We want to load the performance integrations here, if the tracesSampleRate is set for the layer in env vars
// Sentry node's `getDefaultIntegrations` will load them if tracing is enabled,
// which is the case if `tracesSampleRate` is set.
// We can safely add all the node default integrations
integrations: getNodeDefaultIntegrations(
integrations: Sentry.getDefaultIntegrations(
process.env.SENTRY_TRACES_SAMPLE_RATE
? {
tracesSampleRate: parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE),
Expand All @@ -22,7 +21,7 @@ if (lambdaTaskRoot) {
),
});

tryPatchHandler(lambdaTaskRoot, handlerString);
Sentry.tryPatchHandler(lambdaTaskRoot, handlerString);
} else {
throw Error('LAMBDA_TASK_ROOT environment variable is not set');
}
Loading