Skip to content

fix(stepfunctions): resolve qualified Lambda function ARNs in lambda:invoke - #1659

Closed
abanna wants to merge 1 commit into
floci-io:mainfrom
abanna:fix/stepfunctions-lambda-arn
Closed

fix(stepfunctions): resolve qualified Lambda function ARNs in lambda:invoke#1659
abanna wants to merge 1 commit into
floci-io:mainfrom
abanna:fix/stepfunctions-lambda-arn

Conversation

@abanna

@abanna abanna commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

The Step Functions lambda:invoke integration resolved the function name by taking the last
:-segment of the reference. For a qualified ARN like
arn:aws:lambda:<region>:<acct>:function:NAME:$LATEST that yields the qualifier ($LATEST)
instead of NAME, so the invoke failed with Lambda function not found: $LATEST.

This adds extractLambdaFunctionName(), which strips the :function: prefix and an optional
trailing 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

  • Bug fix (fix:)

AWS Compatibility

Step Functions' optimized lambda:invoke accepts a FunctionName that is a bare name, a name with
a :version/:alias qualifier, or a full/partial function ARN (optionally qualified). All of these
must 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 test passes locally — AslExecutorLambdaArnTest (run in eclipse-temurin:25-jdk)
  • New test added — AslExecutorLambdaArnTest (9 cases)
  • Commit messages follow Conventional Commits

…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.
@greptile-apps

greptile-apps Bot commented Jun 30, 2026

Copy link
Copy Markdown

Greptile Summary

Fixes a bug in AslExecutor where qualified Lambda ARNs (e.g. arn:aws:lambda:…:function:NAME:$LATEST) were incorrectly resolved to the trailing qualifier instead of the function name, causing "Lambda function not found" errors.

  • Introduces extractLambdaFunctionName(), a package-private static helper that strips the :function: ARN prefix and an optional trailing version/alias qualifier, correctly handling bare names, names with qualifiers, partial ARNs, and full qualified ARNs.
  • Routes both the direct-ARN path and the optimized arn:aws:states:::lambda:invoke integration path through the new helper, eliminating the previous lastIndexOf(':') logic that failed for qualified ARNs.
  • Adds AslExecutorLambdaArnTest with nine regression cases covering the full range of AWS Lambda FunctionName formats.

Confidence Score: 4/5

The fix is narrow, correct, and well-tested; the only issue is a test class name that deviates from the project's naming convention.

The extractLambdaFunctionName logic correctly handles all documented AWS Lambda FunctionName formats: bare names, qualifier-only suffixes, partial ARNs, and full qualified ARNs including $LATEST, numeric versions, and named aliases. The existing call sites are cleanly updated and the nine unit tests cover the full input space described in the PR. The sole finding is the test class name AslExecutorLambdaArnTest not matching the *ServiceTest.java convention in AGENTS.md.

The test file AslExecutorLambdaArnTest.java should be looked at for naming; AslExecutor.java changes are straightforward and low risk.

Important Files Changed

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]
Loading
%%{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]
Loading

Reviews (1): Last reviewed commit: "fix(stepfunctions): resolve qualified La..." | Re-trigger Greptile

Comment on lines +1 to +10
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)}.
*

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 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!

@abanna

abanna commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate of #1660 (identical change — same extractLambdaFunctionName fix and AslExecutorLambdaArnTest). Two PRs for this fix were opened in parallel by mistake; consolidating on #1660.

@abanna abanna closed this Jun 30, 2026
@abanna
abanna deleted the fix/stepfunctions-lambda-arn branch June 30, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant