aws / aws-extensions-for-dotnet-cli

Extensions to the dotnet CLI to simplify the process of building and publishing .NET Core applications to AWS services
Apache License 2.0
369 stars 86 forks source link

Skipped, error inspecting layer. Invalid Layer name #255

Closed fracampit closed 1 year ago

fracampit commented 1 year ago

Describe the bug

I have the following layer versions:

arn:aws:lambda:eu-west-2:763336740511:layer:capabilities-assets:2
arn:aws:lambda:eu-west-2:763336740511:layer:capabilities-assets:1

When I run dotnet lambda package --project-location $PROJECT_LOCATION --function-layers $LAMBDA_LAYER_ARN -o publish/$CI_PIPELINE_ID.zip, where $LAMBDA_LAYER_ARN is either arn:aws:lambda:eu-west-2:763336740511:layer:capabilities-assets:2 or arn:aws:lambda:eu-west-2:763336740511:layer:capabilities-assets:1, I get the following error:

Inspecting Lambda layers for runtime package store manifests
arn:aws:lambda:eu-west-2:763336740511:layer:capabilities-assets:2: Skipped, error inspecting layer.
Invalid Layer name: arn:aws:lambda:eu-west-2:763336740511:layer:capabilities-assets

Expected Behavior

Inspecting Lambda layers for runtime package store manifests
... arn:aws:lambda:eu-west-2:763336740511:layer:capabilities-assets:2: Downloaded package manifest for runtime package store layer

Current Behavior

Inspecting Lambda layers for runtime package store manifests
arn:aws:lambda:eu-west-2:763336740511:layer:capabilities-assets:2: Skipped, error inspecting layer.
Invalid Layer name: arn:aws:lambda:eu-west-2:763336740511:layer:capabilities-assets

Reproduction Steps

n/a

Possible Solution

No response

Additional Information/Context

No response

Targeted .NET platform

.NET 6, linux-x64

CLI extension version

Amazon Lambda Tools for .NET Core applications (5.6.2)

Environment details (OS name and version, etc.)

.NET 6, linux-x64

fracampit commented 1 year ago

Please let me if you need more details about the issue.

ashishdhingra commented 1 year ago

Hi @fracampit,

Good morning.

Thanks for reporting the issue. The error is possibly thrown during call to IAmazonLambda.GetLayerVersionAsync(). I suspect that the region determined in the environment where dotnet lambda package is being executed is different from eu-west-2 (region for the layers arn:aws:lambda:eu-west-2:763336740511:layer:capabilities-assets:2 or arn:aws:lambda:eu-west-2:763336740511:layer:capabilities-assets:1).

Could you please share the following:

Thanks, Ashish

fracampit commented 1 year ago

@ashishdhingra Thanks for the suggestion, that was it.

The script was running in an environment that had the AWS_DEFAULT_REGION set to eu-west-1. I have added a script that extracts the region from the arn: region=$(echo "$arn" | cut -d':' -f4)

Providing the region extracted from the arn explicitly fixed the issue.

github-actions[bot] commented 1 year ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.