Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context object invoked_arn incomplete #52

Closed
apmclean opened this issue Aug 16, 2017 · 2 comments
Closed

Context object invoked_arn incomplete #52

apmclean opened this issue Aug 16, 2017 · 2 comments
Labels

Comments

@apmclean
Copy link

In Lambda I extract the region the function is running in for various purposes (mostly for creating a boto3 sessions for building clients, assuming roles etc).

eg:

def determine_region(context):

    m = re.match("arn:aws:lambda:(.*?):\d+.*$", context.invoked_function_arn)
    if m:
        return(m.group(1))

SAM Local doesn't appear to include a region in the arn. I get something like:
arn:aws:lambda::104260451092:function:test

I haven't found anywhere I can set the region for the context object in the template.yaml file. Have I missed something?

Thanks!

@sanathkr sanathkr added the bug label Aug 16, 2017
@sanathkr
Copy link
Contributor

Good question. I need to dig deeper to find where the ARN is created and set. I think it comes from Docker container.

@sanathkr
Copy link
Contributor

This is a dupe of #48. In docker-lambda, ARN is constructed by concatenating accountId, region, and function name here https://github.com/lambci/docker-lambda/blob/master/python2.7/run/runtime-mock.py#L51. But due to #48, region is not available in Docker container due to some reason.

I will close this Issue now. Feel free to track #48 for updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants