Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(aws-serverless): Add lambda extension to npm package#20133
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import * as fs from 'fs'; | ||
| // Copy the bash wrapper script into the rollup output directory | ||
| // so the npm package ships both the compiled extension and the wrapper. | ||
| const targetDir = './build/lambda-extension'; | ||
| const source = './src/lambda-extension/sentry-extension'; | ||
| const target = `${targetDir}/sentry-extension`; | ||
| fs.mkdirSync(targetDir, { recursive: true }); | ||
| fs.copyFileSync(source, target); | ||
| // The wrapper must be executable because AWS Lambda discovers extensions by | ||
| // scanning /opt/extensions/ for executable files. If the file isn't executable, | ||
| // Lambda won't register it as an extension. | ||
| fs.chmodSync(target, 0o755); | ||
andreiborza marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -54,10 +54,18 @@ async function buildLambdaLayer(): Promise<void> { | ||
| replaceSDKSource(); | ||
| // Copy the Lambda extension from the shared build output into the layer structure. | ||
| // build/lambda-extension/ contains both index.mjs and the sentry-extension wrapper. | ||
| // Lambda requires the wrapper to be in /opt/extensions/ for auto-discovery, | ||
| // so it gets copied there separately. | ||
| fs.cpSync('./build/lambda-extension', './build/aws/dist-serverless/sentry-extension', { recursive: true }); | ||
| fs.chmodSync('./build/aws/dist-serverless/sentry-extension/index.mjs', 0o755); | ||
| fsForceMkdirSync('./build/aws/dist-serverless/extensions'); | ||
| fs.copyFileSync('./src/lambda-extension/sentry-extension', './build/aws/dist-serverless/extensions/sentry-extension'); | ||
| fs.copyFileSync( | ||
| './build/aws/dist-serverless/sentry-extension/sentry-extension', | ||
| './build/aws/dist-serverless/extensions/sentry-extension', | ||
| ); | ||
cursor[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| fs.chmodSync('./build/aws/dist-serverless/extensions/sentry-extension', 0o755); | ||
sentry[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| fs.chmodSync('./build/aws/dist-serverless/sentry-extension/index.mjs', 0o755); | ||
| const zipFilename = `sentry-node-serverless-${version}.zip`; | ||
| // Only include these directories in the zip file | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.