aws / aws/aws-extensions-for-dotnet-cli

Publish-layer fails to find artifact.xml on x86_64 with .NET 10

Open
#457 0 comments 0 reactions 0 assignees View on GitHub
bug p2 queued
Dominant language
C#
Stars
393
Forks
90
Avg merge
2d 19m
Merged PRs (30d)
3

Description

### Describe the bug

I encountered an issue when running the dotnet lambda publish-layer command targeting the x86_64 architecture with .NET 10 and Amazon.Lambda.Tools version 7.0.0.

The tool successfully generates the layer content and the artifact.xml file under the .NET architecture directory:

.../dotnetcore/store/x64/net10.0/artifact.xml

However, the validation step that follows fails with:

Failed to find artifact.xml file in created local store.

The build output confirms that artifact.xml was successfully created:

Files were composed in /tmp/.../dotnetcore/store/x64/net10.0/

The list of packages stored is in /tmp/.../dotnetcore/store/x64/net10.0/artifact.xml

Failed to find artifact.xml file in created local store.

This appears to be an architecture path mismatch between the AWS Lambda architecture name x86_64 and the .NET architecture directory name x64.

When --function-architecture x86_64 is supplied, the artifact lookup appears to use the Lambda architecture value when determining the path, while dotnet store generates the artifact under x64.

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Expected Behavior

When the Lambda architecture is:

x86_64

the tool should locate the generated artifact.xml under the corresponding .NET store architecture directory:

x64/net10.0/artifact.xml

In other words, the artifact path lookup should map:

x86_64 -> x64
arm64 -> arm64

### Current Behavior

The layer content and artifact.xml are successfully generated under:

.../store/x64/net10.0/artifact.xml

but publish-layer subsequently reports:

Failed to find artifact.xml file in created local store.

### Reproduction Steps

Using:

Amazon.Lambda.Tools 7.0.0
.NET 10
Lambda architecture: x86_64

Run:

```
dotnet lambda publish-layer $lambdaLayerName `
--project-location "../lambda-layer/${ProjectName}.Layer/src/${ProjectName}.Layer" `
--package-manifest "../lambda-layer/${ProjectName}.Layer/src/${ProjectName}.Layer/${artifactFileName}" `
--function-architecture x86_64
```

or

```
dotnet lambda publish-layer $lambdaLayerName `
--project-location "../lambda-layer/${ProjectName}.Layer/src/${ProjectName}.Layer" `
--package-manifest "../lambda-layer/${ProjectName}.Layer/src/${ProjectName}.Layer/${artifactFileName}"
```

### Possible Solution

_No response_

### Additional Information/Context

**Possible Cause**

This may be related to the architecture-specific artifact path changes introduced around:

Issue #408
PR #401

Issue #408 addressed the opposite case, where an ARM64 build generated:

arm64/artifact.xml

but validation incorrectly looked under:

x64/artifact.xml

The fix appears to make the artifact lookup architecture-aware.

For the x86_64 case, however, there is an additional naming difference:

AWS Lambda architecture: x86_64
.NET architecture folder: x64

If the --function-architecture value is used directly as the store directory name, the tool may attempt to locate:

.../store/x86_64/net10.0/artifact.xml

while dotnet store actually creates:

.../store/x64/net10.0/artifact.xml

A possible fix would be to translate the AWS architecture value to the corresponding .NET architecture directory when constructing the artifact path:

var architectureDirectory = Architecture switch
{
"x86_64" => "x64",
"arm64" => "arm64",
_ => "x64"
};

**Temporary Workaround**

A temporary workaround is to downgrade Amazon.Lambda.Tools to version 5.11.0 when publishing the Lambda layer:

`dotnet tool install -g Amazon.Lambda.Tools --version 5.11.0`

With version 5.11.0, the publish-layer command successfully finds the generated artifact.xml under the x64 directory and publishes the layer without the path mismatch error.

The published layer can also be attached to an x86_64 Lambda function and works without an architecture compatibility error.

### Targeted .NET platform

.NET 10

### CLI extension version

**CLI extension version**

Amazon.Lambda.Tools 7.0.0

**Architecture**

x86_64

### Environment details (OS name and version, etc.)

Windows 11

Contributor guide

Open the contributing guide

Research direction

Start at the publish-layer validation and artifact path construction used by the `--function-architecture` entry point, then reproduce with Amazon.Lambda.Tools 7.0.0, .NET 10, and `x86_64`. Compare the generated `store/x64/net10.0/artifact.xml` path with the validation lookup; done means the command finds the artifact and publishes the layer for both `x86_64` and `arm64`.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, csharp
Domain
cli, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.