1 Answer
- Newest
- Most votes
- Most comments
0
I worked on this problem for a few days and didn't really discover an entry-point into the source bundling code used by the CDK. I thought about writing a custom construct but gave up when I saw that there are no plans to support async code in CDK constructs.
I resorted to the following workaround:
- Run whatever your build process is prior to running
cdk deploy. - Zip up the manually-built code.
- Copy the zip file to an S3 bucket with appropriate permissions.
- Change the
CodeUriattribute of yourAWS::Serverless::Functionto aFunctionCodetype value. - Change the
BucketandKeyvalues ofCodeUrito reflect the zip you just uploaded. - Run
cdk deploy.
It's not as beautiful as keeping everything within the CDK scripts, but it's working (and without sam).
answered 2 years ago
Relevant content
- asked 3 years ago

I'm getting stuck behind this a full two years later and have been going nuts for days trying to find a workaround. If I come up with something, I'll update.