By using AWS re:Post, you agree to the AWS re:Post Terms of Use

Lambda execution with a function URL is different than when tested in the Lambda console.

0

I have a weird anomaly happening: Lambda execution with a function URL is different than when tested in the Lambda console.

In short, here's what the function does:

  1. Connects to DynamoDB and choose a specific table. The table has 4 attributes in it.
  2. Performs a get_item on an attribute that contains a number in it, a string.
  3. Increment the number by 1.
  4. Complete an update_item.
  5. Perform a get_item on fetch that attribute as a check to make sure it was updated.
  6. Return the number back to the caller.

Throughout, I check to make sure I am getting a 200 returned, again checking that the attribute was incremented.

From the Lambda console, the function performs exactly as designed. ~80ms in a cold start and 7 ms in a warm start. All good. Each time executed, I check the table in the DynamoDB console. All perfect.

Now, when I execute the FUNCTION URL created in the Lambda function, it performs, however, it increments the attribute by 2, not by one - when checking the table after each execution. The return value returns a number that indicates an increment by 1, however, the attribute in the table has been incremented by 2.

It's a simple function. Any thoughts on why the execution in a function URL created in the Lambda console executed differently than in the Lambda console?

Thank you!

profile picture
asked 7 months ago234 views
1 Answer
1

I would start by turning on data events for Lambda. There is more information linked here on how to accomplish that. I suspect that your browser is making more than one call (such as a call for favicon).

You might also want to try something like curl to test the function url to see if you get a different result.

profile pictureAWS
answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions