Hey, since I started logging my API calls I realized there might be some bugs in Eventbridge scheduled HTTP Api Invocations. In general, the Apis don't get invoked when they should be. Often they get invoked twice instead of once.
For example my Eventbridge cron expression is:
10 8-18 ? * 2-6 *
so at minute 10 from 8-18 on any day of the month on any month from 2nd to 6th day of the week (which ends up being Monday to Friday) and any year.
Now my API logs for this look like this:
- 2022-03-14 13:30:08.963665 +00:00
- 2022-03-14 13:34:02.215564 +00:00
- 2022-03-14 13:38:29.776793 +00:00
- 2022-03-14 13:43:29.320522 +00:00
- 2022-03-14 13:46:57.916126 +00:00
- 2022-03-14 13:51:55.419461 +00:00
- 2022-03-14 13:56:47.090243 +00:00
- 2022-03-14 14:00:41.538169 +00:00
- 2022-03-14 14:06:09.226878 +00:00
- 2022-03-14 14:09:23.691206 +00:00
- 2022-03-14 14:10:22.682902 +00:00
- 2022-03-14 14:11:25.746832 +00:00
- 2022-03-14 14:13:23.880627 +00:00
- 2022-03-14 14:15:23.361370 +00:00
- 2022-03-14 14:16:43.967781 +00:00
- 2022-03-14 14:19:01.799442 +00:00
- 2022-03-14 14:24:30.163322 +00:00
- 2022-03-14 14:25:09.470810 +00:00
- 2022-03-14 14:27:52.924405 +00:00
- 2022-03-14 14:33:32.610750 +00:00
- 2022-03-14 14:33:44.313787 +00:00
It gets invoked many more times!!! Day of the week, month etc. seem to work
and in the header it shows AWS eventbridge.
"user-agent": "Amazon/EventBridge/ApiDestinations"
so it definitely gets invoked by Evenbridge.
What is going on??
Hey, I was thinking a similar thing the requests in the example definitely return a 200 (since I record that as well) but they do take some time (like 5-15 seconds) maybe there is some kind of internal timeout? However, that might explain the 2 attempts in a row but not the random times.
API Destinations maximum timeout is 5 seconds. If it takes your backend longer to respond, EventBridge will retry for up to 24 hours.