Skip to content

fix: correct recognition of lambda path #12629

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thetric
Copy link

@thetric thetric commented May 16, 2025

Motivation

The AWS Lambda SDK invokes /2015-03-31/functions to create a new Lambda function (see https://docs.aws.amazon.com/lambda/latest/api/API_CreateFunction.html) but the handler previously did not recognise it as a Lambda route due to a trailing slash in the path.

Changes

Localstack now recognises /2015-03-31/functions as a Lambda endpoint

@thetric thetric requested a review from alexrashed as a code owner May 16, 2025 10:48
@localstack-bot
Copy link
Collaborator

localstack-bot commented May 16, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Copy link
Collaborator

@localstack-bot localstack-bot left a comment

Choose a reason for hiding this comment

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

Welcome to LocalStack! Thanks for raising your first Pull Request and landing in your contributions. Our team will reach out with any reviews or feedbacks that we have shortly. We recommend joining our Slack Community and share your PR on the #community channel to share your contributions with us. Please make sure you are following our contributing guidelines and our Code of Conduct.

@thetric
Copy link
Author

thetric commented May 16, 2025

I have read the CLA Document and I hereby sign the CLA

localstack-bot added a commit that referenced this pull request May 16, 2025
@alexrashed alexrashed added the semver: patch Non-breaking changes which can be included in patch releases label May 16, 2025
Copy link
Member

@alexrashed alexrashed left a comment

Choose a reason for hiding this comment

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

Thanks a lot, @thetric for the contribution! I would love to hand over the review for this change to our experts on Lambda to make sure that this change (a) really fixes the issue you see, and (b) ensure that this really is in parity with AWS.
@joe4dev @dfangl @gregfurman could you maybe take over here?

@dfangl
Copy link
Member

dfangl commented May 16, 2025

Hi @thetric ! Could you please elaborate what exact issues this solves? Which SDK is affected from this issue?

@thetric
Copy link
Author

thetric commented May 16, 2025

I'm trying to create a new Lambda function with the AWS SDK Java v2. The Lambda client is configured to use an IP address (because it's running in our CI via Docker-in-Docker). With the 4.4 release of Localstack, this request fails with an empty HTTP 200 response and the following log:

l.aws.handlers.service : no service set in context, skipping request parsing

Searching the Localstack code I found https://github.com/localstack/localstack/blob/master/localstack-core/localstack/aws/protocol/service_router.py#L158. The request parsing only recognises Lambda requests if the path starts with /2015-03-31/functions/ but not all Lambda requests contain the trailing slash in the path, such as: https://docs.aws.amazon.com/lambda/latest/api/API_CreateFunction.html: POST /2015-03-31/functions

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.

5 participants