Austin-Mazz / OmNom-OCR

Apache License 2.0
0 stars 0 forks source link

Replace Sam with Digital Clone #11

Closed CLarge-EZAC closed 3 years ago

CLarge-EZAC commented 3 years ago

We have transcended flesh, now there is only software...

https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-windows.html ^Install SAM CLI. This allows you to run Lambda functions locally.

CLarge-EZAC commented 3 years ago

https://stackoverflow.com/questions/64689865/debugging-lambda-locally-using-cdk-not-sam

image

cdk synth --no-staging > template.yaml
sam local invoke MyFunction12345678 --no-event
CLarge-EZAC commented 3 years ago

@Austin-EZAC Let's actually use this instead: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-cdk-getting-started.html It's a hybrid of SAM with CDK, it seems like a convenient solution compared to individually running CDK and then SAM. See #13

CLarge-EZAC commented 3 years ago

I'm actually getting an error that makes me believe this won't work for us:

Synthesizing CDK App
The resource AWS::Lambda::Function 'CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F' has specified S3 location for Code. It will not be built and SAM CLI does not support invoking it locally.

https://github.com/aws/aws-sam-cli/issues/2825 It sounds like a bitch to resolve, and I'm not even convinced I should use SAM. We need to include S3 references in our app, and that breaks SAM's local commands. Apparently CodeUri is part of the solution? I think I spotted that in the CI testing of the original Textract demo.