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
Petrus
質問済み 4ヶ月前203ビュー
1回答
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
回答済み 4ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ