Using powetools as a layer and 'sam local invoke' command #348
-
Hello, When running This error makes sense since ** As a workaround, I added Thank you all, |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 9 replies
-
Hey Tomer - SAM CLI downloads Layers and make them available in the local Docker container, but it sounds like it's not being the case here. Could you share what version of SAM CLI you're using so we can try reproducing that too? Pinging @am29d to see if he has the bandwidth to test today, otherwise I'll create a dummy project on Monday to test this out :) Thanks for reaching out! |
Beta Was this translation helpful? Give feedback.
-
Hi Tomer, thanks for reaching out! I have checked the behaviour on an example project and the correct workflow is to run
if you run the local invoke command without this folder, the dependencies are missing. So make sure to always build run |
Beta Was this translation helpful? Give feedback.
-
Thanks Tomer! I suspect what’s happening here is that SAM CLI cannot
resolve that ARN reference because it isn’t deployed yet.
I’ll test this hypothesis this afternoon and let you know what I find out —
If that doesn’t work at all then we should fall back to provide an opaque
Layer version ARN without a SAR App
…On Mon, 22 Mar 2021 at 14:26, Tomer Levi ***@***.***> wrote:
Hi Alex,
Thanks for helping.
My SAM template looks like the following:
AwsLambdaPowertoolsPythonLayer:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer
SemanticVersion: 1.11.0
AuthorizerLambda:
Type: AWS::Serverless::Function
Properties:
CodeUri: task_functions/
Handler: task_auth.lambda_handler
Runtime: python3.8
Environment:
Variables:
LOG_LEVEL: INFO
POWERTOOLS_SERVICE_NAME: AuthorizerLambda
Layers:
- !GetAtt AwsLambdaPowertoolsPythonLayer.Outputs.LayerVersionArn
When running:
sam build --use-container
This log message is shown:
2021-03-22 15:16:53 Requested to create CFN template arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer/1.11.0 in serverless application repo.
Same log message when thing when running:
sam local invoke -e events/appsync.json TaskCreateLambda
I couldn't fund aws_lambda_powertools inside my build folder:
.aws-sam/build/TaskCreateLambda
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#348 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBCVVRW3TY5UYCYEI33TE5ARRANCNFSM4ZLIECQA>
.
|
Beta Was this translation helpful? Give feedback.
-
Hey Tomer - It'd be great if you could open an issue within the SAM CLI
repo. Also, could you try using this direct Lambda Layer over SAR to double
check a theory of mine?
arn:aws:lambda:eu-west-1:770693421928:layer:Klayers-python38-aws-lambda-powertools:67
You can change the region to the one you're using. If that works for you,
we will prioritize creating a pure Layer as requested here:
#329
Thank you!!
…On Wed, 24 Mar 2021 at 20:50, Tomer Levi ***@***.***> wrote:
@heitorlessa <https://github.com/heitorlessa> @am29d
<https://github.com/am29d> thank you for taking the time and helping.
I can open a new discussion/bug in SAM CLI github repo if you think it's
irrelevant.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#348 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBDJ67M3TEPJ3TCYGVDTFI67VANCNFSM4ZLIECQA>
.
|
Beta Was this translation helpful? Give feedback.
@heitorlessa yes, it works using the direct Lambda layer.
Even using
sam build .... --use-container
Thanks!