in src/export-backend-asset-handler/index.ts [222:257]
private uploadLambdaZip(resourceName: string): BucketDeployment {
const filePath = path.join(
this.exportPath,
FUNCTION_CATEGORY.NAME,
resourceName,
AMPLIFY_BUILDS,
);
const buildFile = path.join(
filePath,
this.validateFilesAndReturnPath(filePath),
);
const deployment = new BucketDeployment(
this,
`${resourceName}-deployment`,
{
destinationBucket: this.deploymentBucket,
sources: [Source.asset(filePath)],
destinationKeyPrefix: AMPLIFY_BUILDS,
prune: false,
},
);
const stacks = this.exportManifest.props.loadNestedStacks;
const logicalId = `${FUNCTION_CATEGORY.NAME}${resourceName}`;
if (stacks) {
const parameters = stacks[logicalId].parameters;
if (parameters) {
parameters[STACK_PARAMETERS.FUNCTION.DEPLOYMENT_BUCKET_NAME] =
this.deploymentBucket.bucketName;
parameters[
STACK_PARAMETERS.FUNCTION.S3_KEY
] = `${AMPLIFY_BUILDS}/${path.basename(buildFile)}`;
}
}
return deployment;
}