Skip to content
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
37 changes: 20 additions & 17 deletions src/ServerlessSpy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,6 @@ export class ServerlessSpy extends Construct {
const layerKey = (r: lambda.Runtime, a: lambda.Architecture) =>
`${r.toString()}_${a.name.toString()}`;

console.log('RUNTIME: ', runtime);
console.log('ARCHITECTURE: ', architecture);

let layer = this.layerMap[layerKey(runtime, architecture)];
let spyWrapperPath = '/opt/spy-wrapper';

Expand All @@ -430,20 +427,26 @@ export class ServerlessSpy extends Construct {
spyWrapperPath = '/opt/python/spy-wrapper';
layer =
layer ||
new PythonLayerVersion(this, 'PythonExtension', {
compatibleRuntimes: [runtime],
compatibleArchitectures: [architecture],
entry: location,
bundling: {
bundlingFileAccess: BundlingFileAccess.VOLUME_COPY,
// command: [
// `cp ${path.join(
// location.substring(0, location.lastIndexOf(path.sep)),
// 'spy-wrapper/spy-wrapper'
// )} /asset-output/python`,
// ],
},
});
new PythonLayerVersion(
this,
`PythonExtension${runtime.name
.replace('python', '')
.replace('.', '_')}`,
{
compatibleRuntimes: [runtime],
compatibleArchitectures: [architecture],
entry: location,
bundling: {
bundlingFileAccess: BundlingFileAccess.VOLUME_COPY,
// command: [
// `cp ${path.join(
// location.substring(0, location.lastIndexOf(path.sep)),
// 'spy-wrapper/spy-wrapper'
// )} /asset-output/python`,
// ],
},
}
);
break;
case lambda.Runtime.NODEJS_12_X.name:
case lambda.Runtime.NODEJS_14_X.name:
Expand Down
2 changes: 1 addition & 1 deletion test/cdk/src/pythonLambdaStack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class PythonLambdaStack extends Stack {
const func3 = new lambda.Function(this, 'MyLambdaThatFails', {
memorySize: 512,
timeout: Duration.seconds(5),
runtime: lambda.Runtime.PYTHON_3_9,
runtime: lambda.Runtime.PYTHON_3_11, // use a different version
handler: 'lambdaFail.handler',
architecture: Architecture.X86_64,
code: lambda.Code.fromAsset(path.join(__dirname, '../functions/python/')),
Expand Down
Loading