fix(lambda): accept ARN, partial ARN, qualified names in URL paths#822
Merged
vieiralucas merged 2 commits intomainfrom Apr 28, 2026
Merged
fix(lambda): accept ARN, partial ARN, qualified names in URL paths#822vieiralucas merged 2 commits intomainfrom
vieiralucas merged 2 commits intomainfrom
Conversation
Closes #817. The VS Code AWS Toolkit calls GetFunction with a fully-qualified function ARN (`arn:aws:lambda:REGION:ACCOUNT:function:NAME`), which real AWS Lambda accepts in any URL slot that names a function. fakecloud was looking up the raw URL segment in the in-memory map keyed by short name, so every toolkit request returned 404 and the Lambda explorer in the IDE showed nothing. The fix: - New `normalize_function_name` helper strips full ARN, partial ARN (`ACCOUNT:function:NAME`), and trailing `:qualifier` (version or alias) down to the bare name. Inputs that don't match any of those shapes pass through unchanged. - Helper percent-decodes its input first, since SDKs URL-encode `:` in path segments (`arn%3Aaws%3Alambda%3A...`). - Applied at dispatch: `handle()` normalizes `resource_name` for every action that takes a `FunctionName` (Get/Delete/Invoke/etc., aliases, concurrency, URL config, event invoke config, recursion config, versions, policy, scaling). Layer / event-source-mapping routes are untouched — those carry different identifiers. Coverage: - 8 unit tests for the normalizer (bare name, qualifier strip, full ARN, qualified full ARN, partial ARN, malformed ARN passthrough, empty, percent-encoded ARN) - 3 unit tests exercising `LambdaService::handle` end-to-end with full ARN, partial ARN, and `name:qualifier` - 1 e2e test via aws-sdk-lambda calling `GetFunction` with all three forms — same code path the VS Code toolkit hits
There was a problem hiding this comment.
1 issue found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/fakecloud-lambda/src/service.rs">
<violation number="1" location="crates/fakecloud-lambda/src/service.rs:67">
P2: Add the missing function-name actions to action_takes_function_name; otherwise runtime-management-config and durable-executions routes still won't accept ARN/qualified names and will continue to 404 on those endpoints.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…n ARN normalization Cubic catch on #822: PutRuntimeManagementConfig, GetRuntimeManagementConfig, and ListDurableExecutionsByFunction also live under /functions/{name}/... and were missing from the action_takes_function_name allowlist, so they would still 404 on ARN / qualified-name input.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Closes #817.
The VS Code AWS Toolkit calls
GetFunctionwith a fully-qualified function ARN. Real AWS Lambda accepts ARN, partial ARN (ACCOUNT:function:NAME), andname:qualifierin any URL slot that names a function. fakecloud was looking up the raw URL segment in the in-memory map keyed by short name, so every toolkit request returned 404 and the Lambda explorer in the IDE showed nothing.normalize_function_namehelper strips full ARN, partial ARN, and trailing:qualifierdown to the bare name. Percent-decodes first since SDKs URL-encode:in path segments (arn%3A...).handle()normalizes the resource name for every action that takes aFunctionName(Get/Delete/Invoke/aliases/concurrency/URL config/event invoke config/recursion config/versions/policy/scaling). Layer and event-source-mapping routes are untouched.Test plan
LambdaService::handleend-to-end with full ARN, partial ARN, andname:qualifieraws-sdk-lambdacallingGetFunctionwith all three forms — same code path the VS Code toolkit hitscargo clippy --workspace --all-targets -- -D warningscleancargo fmt --allcleanSummary by cubic
Accept full ARNs, partial ARNs, and name:qualifier in Lambda function URL paths to match AWS behavior. This fixes GetFunction 404s from the VS Code AWS Toolkit so functions appear in the IDE.
Bug Fixes
FunctionName, including runtime management and durable-executions routes; layer and event-source-mapping routes are unchanged.Dependencies
percent-encodingfor URL-decoding path segments.Written for commit 55daeeb. Summary will update on new commits. Review in cubic