aws / aws/aws-sam-cli

Support for context.function_name?

Open
#681 9 comments 2 reactions 0 assignees View on GitHub
maintainer/need-followup stage/needs-attention type/question
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

**Description:**
I want a lambda to call itself. I am using an expression inside a python programme
FunctionName=context.function_name

yet, it returns ResourceNotFoundException error as there is no such a function, actually somehow (why?) named test..
with the arn (as example) arn:aws:lambda::eu-west-1:104260451092:function:test.

If I set an enviroment variable: AWS_LAMBDA_FUNCTION_NAME inside template, it will work "almost" ok, but it will call aws account lambda, not the local one which I test.

So how to reference (the function name) of the locally invoked lambda function, so it will call itself ?

I thought it will be a name such as a copy of a main handler file - in my case name (name.py)

but no, as again - An error occurred (ResourceNotFoundException) when calling the Invoke operation: Function not found: arn:aws:lambda:eu-west-1:104260451092:function:main

**Output of `sam --version`**:
SAM CLI, version 0.6.0

Hope there is still a way to pass a function name to the local lambda, not to call the aws one, but to call itself.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.