Fix: Use function architecture for layer artifact path #401
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Problem
The
publish-layercommand was using a hardcoded "x64" architecture path to locate theartifact.xmlfile generated bydotnet store. This caused a failure when attempting to publish a layer for other architectures, such asarm64, because the file was not found at the expected path.The Solution
This change fixes the issue by dynamically determining the architecture directory. Instead of using a hardcoded "x64", the code now uses the value from the
--function-architectureargument, retrieved via theGetStringValueOrDefaultmethod. If no architecture is provided, it defaults to "x64" to ensure backward compatibility.How the Change Was Tested
The fix was validated on a Windows x86_64 host, using a Docker container with the
mcr.microsoft.com/dotnet/sdk:8.0image for thelinux/arm64platform. The following steps were performed inside the container:Amazon.Lambda.Toolstool was built and installed from the modified source code.dotnet lambda publish-layercommand was executed with the--function-architecture arm64argument.arm64architecture as expected.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.