Skip to content

Feature request: SAM local lambda server should support function ARNs on invoke API. #8289

Closed

Description

@bchampp

Describe your idea/feature/enhancement

I wish that when running the sam local start-lambda server, I could hit my lambda functions by calling the invoke API with a function ARN instead of explicitly requiring a function name.

Proposal

Rather than explicitly requiring the lambda runner to take in the function name, it should take in either a function name or ARN, and normalize it somewhere around here

Things to consider:

  1. Will this require any updates to the SAM Spec - No

Activity

  1. added
    stage/needs-triageAutomatically applied to new issues and PRs, indicating they haven't been looked at.
    on Oct 1, 2025
  2. dcabib commented on Oct 3, 2025

    @dcabib
    Contributor

    Hey @bchampp,

    I'm a bit confused about what you're trying to achieve here. Let me explain why:

    SAM already has sam remote invoke that does exactly what you'd need for calling deployed Lambdas with ARNs:

    sam remote invoke arn:aws:lambda:us-east-1:123456789012:function:MyFunction

    Now, if you add ARN support to sam local start-lambda, you realize it would still be calling your LOCAL function, right? It would just parse the ARN, extract "MyFunction", and run your local code. The region, account, everything else in that ARN - completely ignored.

    So I'm not sure what problem this solves.

    If you need to call deployed Lambdas → use sam remote invoke
    If you need to test locally → use function names

    What's the actual use case here that these don't cover?

    Because adding ARN parsing just for the sake of it seems like unnecessary complexity. And it might actually confuse people into thinking they're testing against AWS when they're just running local code.

    Can you explain what you're trying to do that doesn't work today?

  3. added 2 commits that reference this issue on Oct 3, 2025
    104749e
    987223c
  4. bchampp commented on Oct 3, 2025

    @bchampp
    MemberAuthor

    Hey @bchampp,

    I'm a bit confused about what you're trying to achieve here. Let me explain why:

    SAM already has sam remote invoke that does exactly what you'd need for calling deployed Lambdas with ARNs:

    sam remote invoke arn:aws:lambda:us-east-1:123456789012:function:MyFunction
    Now, if you add ARN support to sam local start-lambda, you realize it would still be calling your LOCAL function, right? It would just parse the ARN, extract "MyFunction", and run your local code. The region, account, everything else in that ARN - completely ignored.

    So I'm not sure what problem this solves.

    If you need to call deployed Lambdas → use sam remote invoke If you need to test locally → use function names

    What's the actual use case here that these don't cover?

    Because adding ARN parsing just for the sake of it seems like unnecessary complexity. And it might actually confuse people into thinking they're testing against AWS when they're just running local code.

    Can you explain what you're trying to do that doesn't work today?

    Yes -- the goal is to add the same flexibility for parsing function names in sam local as the actual lambda service has (which is covered through sam remote invoke).

    Let's say I have an external system that invokes lambda functions using the full ARN. If I want to test against a sam local start-lambda server, my system will need to normalize the function ARNs. I think this should be handled by SAM local so it has parity with the actual lambda service.

    Does that make sense?

  5. dcabib commented on Oct 3, 2025

    @dcabib
    Contributor

    @bchampp

    I understand your perspective, but using a Lambda ARN in SAM LOCAL (which is designed for local development) seems counterintuitive. While it's technically feasible, we'd essentially be working around the aws sam local's intended purpose by referencing non-local resources.

    Could you share a specific use case where you envision this approach being beneficial?

  6. added a commit that references this issue on Oct 14, 2025
    92e801e
  7. github-actions commented on Oct 14, 2025

    @github-actions
    Contributor

    ⚠️COMMENT VISIBILITY WARNING⚠️

    Comments on closed issues are hard for our team to see.
    If you need more assistance, please either tag a team member or open a new issue that references this one.
    If you wish to keep having a conversation with other community members under this issue feel free to do so.

  8. bchampp commented on Oct 14, 2025

    @bchampp
    MemberAuthor

    @bchampp

    I understand your perspective, but using a Lambda ARN in SAM LOCAL (which is designed for local development) seems counterintuitive. While it's technically feasible, we'd essentially be working around the aws sam local's intended purpose by referencing non-local resources.

    Could you share a specific use case where you envision this approach being beneficial?

    I think the intention for SAM local is to closely replicate the actual service. So, in the case of supporting the different ways that we can pass function name in the Invoke API against the service, we'd want SAM local to support the same.

    The use-case I have in mind is customers who want to use SAM as their local lambda server, and they want to call Invoke using the full function ARN, or partial ARN. Without this change, these customers would need to build a workaround in their system to normalize the function ARN to just be the name since it isn't supported in SAM. This PR solves that issue by allowing SAM local to support all the different conventions that Invoke can be called with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stage/needs-triageAutomatically applied to new issues and PRs, indicating they haven't been looked at.type/featureFeature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions