# Missed API calls to AWS

**URL:** <https://community.hubspot.com/t/missed-api-calls-to-aws/15441>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [July 23, 2019, 12:14pm UTC](https://community.hubspot.com/t/missed-api-calls-to-aws/15441 "2019-07-23T12:14:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gepot](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/gepot/32/98942_2.png) [@gepot](https://community.hubspot.com/u/gepot)\
**Post date:** [July 23, 2019, 12:14pm UTC](https://community.hubspot.com/t/missed-api-calls-to-aws/15441/1 "2019-07-23T12:14:05Z")

</div>

I developed a serverless app on AWS Lambda that removes contacts who were added via CC without consent. It works well, but I noticed that not all contact events trigger the Lambda function.

I can see that Hubspot fires off the Contact Create event under the webhooks monitor, but when I look at the log files on AWS those contact IDs don’t appear. I keep a list of contacts that were skipped, so I can manually run them through the procedure, but this isn’t ideal.

I changed the API call rate for the Hubspot app to try and mitigate the issue, but alas, there are still contacts that don’t get picked up.

I am not sure where to look for the issue as it seems to disappear between Hubspot and AWS. Any ideas?

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [July 24, 2019, 1:22am UTC](https://community.hubspot.com/t/missed-api-calls-to-aws/15441/2 "2019-07-24T01:22:52Z")

</div>

Hi @gepot,

Are you seeing that when a contact is being created, the webhooks monitoring will show the event however these contacts ain’t being write into the log files on AWS?

Just to be sure, are you referring to the _Manage CCed Contacts_ app? When looking at the webhooks monitoring, I’m able to see that there’s a number of 502 error (filtered by status: failure).

- [502 server error response code indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server.](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502)

Can you check if these are the missing contacts?

---

<div class="post-metadata">

**Author:** ![gepot](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/gepot/32/98942_2.png) [@gepot](https://community.hubspot.com/u/gepot)\
**Post date:** [July 24, 2019, 7:21am UTC](https://community.hubspot.com/t/missed-api-calls-to-aws/15441/3 "2019-07-24T07:21:07Z")

</div>

Hi @WendyGoh ,

Thanks for looking into this!

Yes, the app is _Manage CCed Contacts_. I am aware of the 502 errors and they were resolved, and I can see those errors on my AWS log files anyway (including the contact ID that caused the problem).

You are correct in your understanding - I see in the webhooks monitor that a given contact was created (I can see the contact ID), but when I go into my AWS logs, that contact is nowhere to be seen. I generate detailed logs referencing the contact ID for just this purpose.

What makes this odd is that it only happens intermittently - so far I failed to see a pattern. It is as if the webhook event fires off, but it never reaches the Lambda function.

I keep track of these failed attempts in a dynamic list where the Mark for Review property is unknown (I use this to mark poor quality contacts, but every new contact has this field set when they are parsed through the Manage CCed Contacts app).

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [July 26, 2019, 1:27am UTC](https://community.hubspot.com/t/missed-api-calls-to-aws/15441/4 "2019-07-26T01:27:58Z")

</div>

Hey @gepot,

That’s odd. I would expect that if the webhook notifications is showing in-app on the webhooks monitor, the AWS logs should contain the notification.

In this case, can I check if you’re logging the incoming HTTP request or if you’re just logging the objectId in your application code? If it’s the latter, it might be that the HTTP requests are coming in but something is up between accepting the request and the execution of your lambda code?

Additionally, another probable explanation may be due o how Lambda handles concurrency. So maybe your lambda concurrency settings are too low, and some requests are getting dropped/lost or being [throttled](https://docs.aws.amazon.com/lambda/latest/dg/scaling.html#throttling-behavior).

Hope his helps!

---

<div class="post-metadata">

**Author:** ![gepot](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/gepot/32/98942_2.png) [@gepot](https://community.hubspot.com/u/gepot)\
**Post date:** [July 31, 2019, 6:54am UTC](https://community.hubspot.com/t/missed-api-calls-to-aws/15441/5 "2019-07-31T06:54:09Z")

</div>

Hi @WendyGoh

Thanks for your inputs. I updated my Lambda function to log the request ID in the handler itself, before calling the function that manages the CCed contacts, but alas, I again sit with contacts that weren’t processed and no sign of any calls making it to the Lambda function.

I also checked my concurrency settings - default is 1000 calls per minute which should be ample. The last two contacts that were processed were many minutes apart, and the only two contacts processed today, so concurrency doesn’t seem to be the issue.

All I know is that Hubspot fires off the webhook (otherwise it won’t appear in the monitor logs) and the call seemingly randomly doesn’t make it to AWS. Here is what a typical log entry would look like n AWS for this function:

 ![lambda-log.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/e/e2fdc98f9e80aa6cfffcaad9b60a949eacc128ff.png)

I am at a loss  
 ![16x16_smiley-frustrated.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/a/ab2bb3944725823b01ce5eab7e566f43d37ac1b8.png)

**Edit** : I increased the timeout setting to see if I can catch any failures. I will report back.

---

<div class="post-metadata">

**Author:** ![mansoor292](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mansoor292/32/29892_2.png) [@mansoor292](https://community.hubspot.com/u/mansoor292)\
**Post date:** [February 28, 2020, 8:01pm UTC](https://community.hubspot.com/t/missed-api-calls-to-aws/15441/6 "2020-02-28T20:01:53Z")

</div>

There is a gotcha in Lambda. I am not sure of the extent of your problem and you probably already solved it.

A lambda will stop executing as soon as a response is sent back. So you need to hold it open for either an aribtrary amount of time or wait for a callback form hubspot before returning a response.
