aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
235 stars 77 forks source link

Update-LMFunctionCode cannot update ImageUri #225

Closed krymtkts closed 2 years ago

krymtkts commented 3 years ago

Description

Update-LMFunctionCode cannot update the image URI of Lambda function because this function has a default parameter set named 'FromMemoryStream' and ImageUri option doesn't have a parameter set name.

https://github.com/aws/aws-tools-for-powershell/blob/0b04f48e74c70d7468c7d3582179d38e53708bca/modules/AWSPowerShell/Cmdlets/Lambda/Basic/Update-LMFunctionCode-Cmdlet.cs#L45

https://github.com/aws/aws-tools-for-powershell/blob/0b04f48e74c70d7468c7d3582179d38e53708bca/modules/AWSPowerShell/Cmdlets/Lambda/Basic/Update-LMFunctionCode-Cmdlet.cs#L75-L83

So we cannot update image URI using the ImageUri option. It is blocked by unnecessary mandatory parameter ZipFile. Of course the ImageUri option cannot use with ZipFile option.

# requires input `ZipFile` parameter.
Update-LMFunctionCode -FunctionName $functionName -ImageUri $imageUri
# cmdlet Update-LMFunctionCode at command pipeline position 1
# Supply values for the following parameters:
# ZipFile[0]:

Update-LMFunctionCode -FunctionName $functionName -ImageUri $imageUri -ZipFile .\Package.zip
# Update-LMFunctionCode: Please don't provide ImageUri when updating a function with packageType Zip.

aws cli v2 works well in the same case.

aws lambda update-function-code --function-name ${functionName} --image-uri ${imageUri}
# we can update imageUri.

Reproduction Steps

Logs

none.

Environment

 $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
PS> Get-Module AWS.Tools.Lambda

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     4.1.13.0              AWS.Tools.Lambda                    {Add-LMLayerVersionPermission, Add-LMPermission, Add-LMResourceTag, Get-LMAccountSetting…}

Resolution


This is a :bug: bug-report

ashishdhingra commented 3 years ago

Similar to repro in https://github.com/aws/aws-tools-for-powershell/issues/202

Reproduction Steps:

FROM public.ecr.aws/lambda/dotnet:5.0 as base

FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim as build
COPY . /TestFunction

WORKDIR /TestFunction

RUN dotnet build "TestFunction.csproj" --configuration Release --output /app/build

FROM build AS publish
RUN dotnet publish "TestFunction.csproj" \\
    --configuration Release \\
    --runtime linux-x64 \\
    --self-contained false \\
    --output /app/publish \\
    -p:PublishReadyToRun=true

FROM base AS final
WORKDIR /var/task

COPY --from=publish /app/publish .
coreyfournier commented 2 years ago

Any movement on this? It's affecting me. Due to ML models being so large we must use docker images to use lambda functions.

Kralizek commented 2 years ago

I'm also affected.

ashishdhingra commented 2 years ago

This should be fixed in AWS.Tools.Lambda 4.1.18.0

github-actions[bot] commented 2 years 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.