question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'ILambdaContext.InvokedFunctionArn' always returning 'null'

See original GitHub issue

Description

I’ve created a new lambda function and I wanted to get the ARN for the function to pass along into my code for further processing. However, ILambdaContext.InvokedFunctionArn is always returning null, both when testing locally, as well as when calling the function in the real environment.

The documentation for the property does not state it can ever be null:

The ARN used to invoke this function. It can be function ARN or alias ARN. An unqualified ARN executes the $LATEST version and aliases execute the function version they are pointing to.

Reproduction Steps

  1. Create empty lambda
  2. Access the InvokedFunctionArn property in the ILambdaContext passed into the function
  3. Check that the value is always null

Environment

  • Package Version: Amazon.Lambda.Core v1.2.0
  • OS Info: Windows 10
  • Build Environment Visual Studio 2019
  • Targeted .NET Platform: NetCore 3.1

Resolution

  • 👋 I can/would-like-to implement a fix for this problem myself

This is a 🐛 bug-report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ashishdhingracommented, Aug 3, 2023

The feature to set the default values on the ILambdaContext for FunctionName, InvokedFunctionArn and AwsRequestId has been released in version 0.14.0 of Amazon.Lambda.TestTool.

1reaction
normjcommented, Feb 9, 2022

Agreed we should not close this. It goes along with other feature requests to customize the context object. Plus I do think a dummy arn is better then a null arn.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Access ILambdaContext in Lambda Entrypoint for dotnet ...
I've used an example from here to try override the FunctionHandlerAsync entrypoint but the Lambda context is null. I have also tried many...
Read more >
Lambda Function Returning Null : r/aws
I am putting together a lambda function for updating users in the user pool, but no matter what I try I it always...
Read more >
AWS Lambda context object in C# - ...
InvokedFunctionArn – The Amazon Resource Name (ARN) that's used to invoke the function. Indicates if the invoker specified a version number or alias....
Read more >
A two week search for the missing body of a Lambda ...
If serverless-http was always returning an object, and the application was not throwing bogus errors, maybe the bug was inside the Lambda ...
Read more >
Why is JSON.parse(event.body) returning null despite form ...
I'm trying to get values being passed into a form to themselves be passed to my lambda function backend. The first roadblock I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found