fix(stepfunctions): resolve qualified Lambda function ARNs in lambda:invoke - #1659
fix(stepfunctions): resolve qualified Lambda function ARNs in lambda:invoke#1659abanna wants to merge 1 commit into
Conversation
…invoke The lambda:invoke integration took the last ':'-segment of FunctionName, yielding the version/alias qualifier (e.g. $LATEST) instead of the function name for ARNs like arn:aws:lambda:region:acct:function:NAME:$LATEST, causing 'Lambda function not found: $LATEST'. Add extractLambdaFunctionName() to strip the :function: prefix and an optional qualifier, used at both the direct-ARN and optimized-integration call sites. Covered by AslExecutorLambdaArnTest.
|
| Filename | Overview |
|---|---|
| src/main/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutor.java | Adds extractLambdaFunctionName() to correctly parse bare names, qualified names, and full/partial ARNs; routes both the direct-ARN and optimized-integration call sites through it. Logic is correct and handles all documented AWS Lambda FunctionName formats. |
| src/test/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutorLambdaArnTest.java | Nine unit tests covering bare names, qualified names, partial ARNs, and full qualified ARNs including $LATEST, numeric versions, and aliases. Test class name deviates from the project's *ServiceTest.java convention (AGENTS.md). |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[invokeResource called\nwith resource + input] --> B{resource contains\n':lambda:' AND ':function:'?}
B -- Yes --> C[extractLambdaFunctionName\nresource]
B -- No --> D{resource ==\n'arn:aws:states:::lambda:invoke'?}
D -- Yes --> E[fnRef = input.FunctionName]
E --> F{fnRef != null?}
F -- Yes --> G[extractLambdaFunctionName\nfnRef]
F -- No --> H[functionName = null]
G --> I[functionName = result]
C --> I
D -- No --> H
I --> J{functionName != null?}
J -- Yes --> K[lookup in functionStore\nby region + name]
K --> L{found?}
L -- Yes --> M[invoke Lambda]
L -- No --> N[throw: Lambda function not found]
J -- No --> O[fall through to other integrations]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[invokeResource called\nwith resource + input] --> B{resource contains\n':lambda:' AND ':function:'?}
B -- Yes --> C[extractLambdaFunctionName\nresource]
B -- No --> D{resource ==\n'arn:aws:states:::lambda:invoke'?}
D -- Yes --> E[fnRef = input.FunctionName]
E --> F{fnRef != null?}
F -- Yes --> G[extractLambdaFunctionName\nfnRef]
F -- No --> H[functionName = null]
G --> I[functionName = result]
C --> I
D -- No --> H
I --> J{functionName != null?}
J -- Yes --> K[lookup in functionStore\nby region + name]
K --> L{found?}
L -- Yes --> M[invoke Lambda]
L -- No --> N[throw: Lambda function not found]
J -- No --> O[fall through to other integrations]
Reviews (1): Last reviewed commit: "fix(stepfunctions): resolve qualified La..." | Re-trigger Greptile
| package io.github.hectorvent.floci.services.stepfunctions; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
|
||
| /** | ||
| * Regression tests for {@link AslExecutor#extractLambdaFunctionName(String)}. | ||
| * |
There was a problem hiding this comment.
Test naming convention mismatch
AGENTS.md specifies that unit tests must follow the *ServiceTest.java pattern. The new file is named AslExecutorLambdaArnTest, which deviates from this convention. Consider renaming it to AslExecutorServiceTest (or similar) to align with the project's stated standard.
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
The Step Functions
lambda:invokeintegration resolved the function name by taking the last:-segment of the reference. For a qualified ARN likearn:aws:lambda:<region>:<acct>:function:NAME:$LATESTthat yields the qualifier ($LATEST)instead of
NAME, so the invoke failed withLambda function not found: $LATEST.This adds
extractLambdaFunctionName(), which strips the:function:prefix and an optionaltrailing version/alias qualifier, and routes both the direct-ARN and optimized-integration call
sites through it. The function store is keyed by name, so the qualifier must be dropped.
Type of change
fix:)AWS Compatibility
Step Functions' optimized
lambda:invokeaccepts aFunctionNamethat is a bare name, a name witha
:version/:aliasqualifier, or a full/partial function ARN (optionally qualified). All of thesemust resolve to the bare function name. Verified against bare names, qualified names, partial ARNs,
and full qualified ARNs (incl.
$LATEST, numeric versions, and named aliases).Checklist
./mvnw testpasses locally —AslExecutorLambdaArnTest(run ineclipse-temurin:25-jdk)AslExecutorLambdaArnTest(9 cases)