Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
bind(context: cdk.Construct): SourceConfig {
let id = 1;
while (context.node.tryFindChild(`Asset${id}`)) {
id++;
}
const asset = new s3_assets.Asset(context, `Asset${id}`, { path });
if (!asset.isZipArchive) {
throw new Error(`Asset path must be either a .zip file or a directory`);
}
return {
bucket: asset.bucket,
zipObjectKey: asset.s3ObjectKey
};
}
};