Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Publish-AWSPowerShellLambda to set function runtime if it does not match the built csproj #1267

Closed
1 of 2 tasks
mryanmurphy opened this issue Aug 4, 2022 · 5 comments
Labels
feature-request A feature should be added or improved. module/lambda-client-lib p1 This is a high priority issue queued

Comments

@mryanmurphy
Copy link

Describe the feature

Publish-AWSPowerShellLambda would be a better experience if it would automatically upgrade the function config to match the correct dotnet runtime prior to uploading function code. There is no parameter to specify this, so you need to trigger it via some other mechanism.

Use Case

When publishing a function via Publish-AWSPowerShellLambda, if the current function config does not match what was built the deployment will fail.

Error updating code for Lambda function: The runtime parameter of dotnetcore2.1 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (dotnet6) while creating or updating functions.

Proposed Solution

The csproj target framework is specified in blueprints: https://github.com/aws/aws-lambda-dotnet/blob/master/PowerShell/Module/Templates/Blueprints/projectfile.csproj.txt#L3

This should be used to call dotnet lambda update-function-config to set the runtime prior to updating function code.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS .NET SDK and/or Package version used

AWSLambdaPSCore 3.0.1.0

Targeted .NET Platform

.NET 6

Operating System and version

Windows 10

@mryanmurphy mryanmurphy added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Aug 4, 2022
@ashishdhingra
Copy link
Contributor

One of the caveat here is if the function runtime is actually supported by Lambda environment. For example, .NET Core 2.1 is no longer supported. Needs review with the team.

@ashishdhingra ashishdhingra added needs-review and removed needs-triage This issue or PR still needs to be triaged. labels Aug 4, 2022
@ashishdhingra ashishdhingra added the p1 This is a high priority issue label Dec 8, 2022
@ashishdhingra
Copy link
Contributor

Fix should be similar for another related issue #476.

@96malhar
Copy link
Contributor

This issue cannot be reproduced since it requires an existing Lambda function with a .NET runtime that is no longer supported by Lambda. The same problem was also reported to us for C# based Lambda functions - #476.

As outlined by normj's comment, this issue was caused by the fact that Amazon.Lambda.Tools made 2 service calls -- the first call was to update the function code followed by a second call to update the function runtime.

We released a fix for this issue in Amazon.Lambda.Tools that flipped the order of these service calls - aws/aws-extensions-for-dotnet-cli#265.

Since the Publish-AWSPowerShellLambda cmdlet uses Amazon.Lambda.Tools under the covers, the above fix also applies to PowerShell based Lambda functions.

@96malhar
Copy link
Contributor

Closing this issue since it has been fixed via aws/aws-extensions-for-dotnet-cli#265.

Copy link
Contributor

⚠️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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. module/lambda-client-lib p1 This is a high priority issue queued
Projects
None yet
Development

No branches or pull requests

3 participants