8000 Fix provisioned concurrency set on Lambda alias by dfangl · Pull Request #12592 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

Fix provisioned concurrency set on Lambda alias #12592

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

Merged
merged 4 commits into from
May 7, 2025

Conversation

dfangl
Copy link
Member
@dfangl dfangl commented May 7, 2025

Motivation

Currently, when setting provisioned concurrency on a lambda alias pointing to a version, and then invoking it, there will still be another container spawned up on demand.

This happens due to an error in the lookup of the provisioned concurrency config in the counting service, which issues leases for environments.

Changes

  • Provisioned concurrency environments of a config set on an alias should now work as expected

@dfangl dfangl requested a review from joe4dev as a code owner May 7, 2025 13:52
@dfangl dfangl added the semver: patch Non-breaking changes which can be included in patch releases label May 7, 2025
@dfangl dfangl self-assigned this May 7, 2025
Copy link
Member
@joe4dev joe4dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix @dfangl 👏👏👏
Good catch 🕵️

@@ -156,6 +156,12 @@ def get_invocation_lease(
provisioned_concurrency_config = function.provisioned_concurrency_configs.get(
function_version.id.qualifier
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs: Would a docstring help to clarify our findings?

# Look up a potential provisioned concurrency config for aliases because a function version shares provisioned concurrency with aliases. However, the config only applies to a single function version or alias on the CRUD level.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some comments on it!

Copy link
Contributor
@gregfurman gregfurman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@@ -2539,6 +2539,59 @@ def test_provisioned_concurrency(self, create_lambda_function, snapshot, aws_cli
result2 = json.load(invoke_result2["Payload"])
assert result2 == "on-demand"

@markers.aws.validated
def test_provisioned_concurrency_on_alias(self, create_lambda_function, snapshot, aws_client):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Should we be confirming within the test that no additional containers are brought up?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be an additional container brought up for the last invocation, but in general, confirming that we hit the right invocation type environment should be sufficient, otherwise we cannot validate it against AWS as well.

@dfangl dfangl added this to the 4.4 milestone May 7, 2025
@dfangl dfangl merged commit c09b347 into master May 7, 2025
29 checks passed
@dfangl dfangl deleted the lambda/alias-provisioned-concurrency branch May 7, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0