简体   繁体   中英

AWS Lambda - [ERROR] (rapid) Failed to reserve: AlreadyReserved

My AWS Lambda occasionally fails receiving event message from Monday.com. I'm using a containerized Lambda deployment (via Docker). The flow is:

  1. There's a Monday.com board (just like an excel spreadsheet) where some data is being entered.
  2. Every time new row is created, Monday.com pushes an "ItemCreated" event to my Lambda (using webhook)
  3. Every time a column is updated, Monday.com pushes an "ItemUpdated" event to my Lambda (using webhook)
  4. When I create+update the record almost instantly, the "ItemCreated" event gets through to my Lambda, but the 2nd event fails with the following message
31 Mar 2022 20:51:03,614 [ERROR] (rapid) Failed to reserve: AlreadyReserved

Here's bigger log:

2022-03-31 20:51:01.587 | Info | Functions.Post:: MONDAY 'item created' REQUEST
-
2022-03-31 20:51:01 | Info | Functions.SendCreateCommandAsync()
-
2022-03-31 20:51:01 | Info | Functions.SendCreateCommandAsync() Sending command :: {"PulseId":2452591832,"AssetName":null,"AssetType":"Webinar","CreatedDate":"2022-03-31T20:51:01.427Z"}
START RequestId: 8a5fa4f7-dacb-49ba-a9ac-4aa4f0797643 Version: $LATEST
31 Mar 2022 20:51:03,614 [ERROR] (rapid) Failed to reserve: AlreadyReserved
END RequestId: a2992224-4cfc-4938-bed7-3d9120ec770e
REPORT RequestId: a2992224-4cfc-4938-bed7-3d9120ec770e Duration: 2061.62 ms Billed Duration: 2062 ms Memory Size: 3008 MB Max Memory Used: 3008 MB
START RequestId: 1dfda2a7-e0ec-44a3-9770-ba1e80221197 Version: $LATEST
-

Seems like the two events are fired to close to each other and the 2nd one cannot get through. How do I mitigate it?

This error [ERROR] (rapid) Failed to reserve: AlreadyReserved occurs when you try to invoke AWS Lambda function running in the container image while another request is processed. To be more precise it is thrown by the AWS Lambda Runtime Interface Emulator (RIE), which is included all base AWS Lambda images and makes possible to invoke your Lambda function packaged as a container image. Unfortunately, you won't be able to execute multiple requests in parallel locally.

In case this helps anyone, I had this error when running my lambda functions locally like so:

sam local start-api --warm-containers EAGER

The fix was to remove the warm containers flag. More info here: https://github.com/aws/aws-sam-cli/issues/2502

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM