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

Switch from InvokeAsync to the newer Invoke API #21

Open
specious opened this issue Feb 1, 2023 · 2 comments
Open

Switch from InvokeAsync to the newer Invoke API #21

specious opened this issue Feb 1, 2023 · 2 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed maintenance Keep the technology up to date

Comments

@specious
Copy link
Member

specious commented Feb 1, 2023

I have received an automated email from AWS regarding the use of the deprecated InvokeAsync API to call lambda function that logs an event in the event-log DynamoDB table:

let response = await lambda.invokeAsync({

The recommendation is to use the newer Invoke function with InvocationType set to Event to make the call asynchronous.

Here is the text from the email:

You are receiving this message because we identified AWS Lambda functions in your account that are using the deprecated InvokeAsync API [1], which was deprecated in 2015 and is replaced by the Invoke API [2].

The following is a list of your affected AWS Lambda functions:
arn:aws:lambda:us-east-1:999999999999:function:log-event

While Lambda continues to support customers using the deprecated API, the API does not receive any new updates. The deprecated InvokeAsync API does not consider reserved concurrency [3] for a function as reserved concurrency was launched in 2017, after the InvokeAsync API was deprecated. When a function using the InvokeAsync API with reserved concurrency experiences throttles, you may also experience throttles for other functions in the account. With Invoke API with InvocationType as Event, Lambda will only throttle the function with a reserved concurrency in such an event without impacting other functions in the account.

To ensure that your functions continue to benefit from optimizations in asynchronous processing, we recommend you to migrate your existing functions to the Invoke API. If the impacted AWS Lambda functions are already deleted, no further action is required.

If you have any questions, please contact AWS Support [4].

[1] https://docs.aws.amazon.com/lambda/latest/dg/API_InvokeAsync.html
[2] https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html
[3] https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html
[4] https://aws.amazon.com/support

There is nothing urgent about making this change, however AWS recommends switching to the newer and better supported API for the reasons given in the email.

I would strongly recommend taking a closer look at the code in the first place to see if it could be written differently to begin with.

@specious specious added good first issue Good for newcomers help wanted Extra attention is needed maintenance Keep the technology up to date labels Feb 1, 2023
@Princeyadav05
Copy link

Hi @specious ,

Can I take a stab at this? I've fair amount of experience working with dynamoDb for my current organisation.

@specious
Copy link
Member Author

specious commented Feb 1, 2023

@Princeyadav05, of course, go ahead.

As a first step I'd recommend following the readme to deploy an instance of the backend to your personal aws account so that you can test before and as you change the code. It's fine to deploy it without RDS to work on this functionality, but having RDS will give you the postgres database which allows locations to be stored.

Although events are logged when a location is added (which fails without the postgres database running on RDS), entries are also logged when users log in and log out:

https://github.com/littermap/littermap-aws-backend/search?q=logevent

Check that events are being logged by using the manage toolkit or by checking the table directly (e.g., in the aws console).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed maintenance Keep the technology up to date
Projects
None yet
Development

No branches or pull requests

2 participants