SAM Local Invoke: Layer endpoint not found

0

Hi,
I'm trying to set up a local dev environment for my Lambda functions using SAM. I had everything working until I added a reference to a layer in my configuration.

I followed the instructions here: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-layers.html. I added my ARN for my layer version in my template.ymal (image attached). However when running a "sam local invoke" I get an error stating "EndpointConnectionError: Could not connect to the endpoint URL" (screenshot attached).

The way I've added the ARN in the configuration seems to be exactly how they do it in the example so I'm not sure what is causing the error.

Darrenk
已提問 5 年前檢視次數 1281 次
4 個答案
0

Hi,
Note: I haven't tried adding the Layers based off of the link you provided (so apologize in advance if you wanted help with this specific method). However, I was able to successfully follow the directions in the following link:
https://aws.amazon.com/blogs/compute/working-with-aws-lambda-and-lambda-layers-in-aws-sam/
which allowed me to create a lambda layer and invoke it locally from my desktop.
Hope this helps,
-randy

已回答 5 年前
0

Hi Randy,
Thanks for trying this. Both articles seem to use the same method of adding the Layer Version ARN to the template.ymal.

The URL it is trying to connect to doesn't look right: "https://lambda.eu-west-1a.amazonaws.com/2018-10-31/layers/arn%3Aaws%3Alambda%3Aeu-west-1%3A326436164324%3Alayer%3AGlobal/versions/7". Does your output show the Layer endpoint URL when running the local invoke command? If not would you be able to change your Layer ARN to something random to attempt to recreate the error so I have another URL to check mine against?

Kind regards,
Darren

Darrenk
已回答 5 年前
0

I've found the issue. My ~/.aws/config file had the region set to "eu-west-1a" when it should have been "eu-west-1".

Darrenk
已回答 5 年前
0

Thanks! That was the problem for me too.

lioness
已回答 4 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南