# Engagements API 500 Internal Server Error

**URL:** <https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972>\
**Category:** APIs & Integrations\
**Tags:** timeline-and-extensions-apis\
**Created:** [April 12, 2019, 10:48am UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972 "2019-04-12T10:48:34Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![JonesTrac](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jonestrac/32/1529_2.png) [@JonesTrac](https://community.hubspot.com/u/JonesTrac)\
**Post date:** [April 12, 2019, 10:48am UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/1 "2019-04-12T10:48:34Z")

</div>

For a couple of months now I’ve been using Power Query to get data from the Hubspot API. I have a query which gets all engagements. This was working fine but for a few days now has been returning a 500 Internal Server after several rounds of pagination. Other calls such as to the Get All Companies API work ok

Query Function below:

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

et  
Pagination = List.Skip(List.Generate( () =\> [IsMore = null, Last\_Key = 0, Counter = 0], // Start Value  
each [IsMore] \<\> false,// Whilst this is true, keep going

each [WebCall = Json.Document(Web.Contents(“[https://api.hubapi.com](https://api.hubapi.com)”,  
[  
RelativePath=“engagements/v1/engagements/paged?hapikey=\*\*\*&limit=250&offset=” & Text.From([Last\_Key])  
]  
)),  
Last\_Key = try [WebCall][#“offset”] otherwise 0,  
IsMore = if [Counter] \< 1 then null else [WebCall][#“hasMore”],  
Counter = [Counter]+1,  
Table = Table.FromRecords(WebCall[results])  
]  
,each [Table] // selector  
) ,1),  
Custom1 = Table.Combine(Pagination),

The error message shown is:

DataSource.Error: Web.Contents failed to get contents from ‘[https://api.hubapi.com/engagements/v1/engagements/paged?hapikey=\*\*\*&limit=250&offset=1581446265](https://api.hubapi.com/engagements/v1/engagements/paged?hapikey=***&limit=250&offset=1581446265)’ (500): Internal Server Error  
Details:  
DataSourceKind=Web  
DataSourcePath=[https://api.hubapi.com/engagements/v1/engagements/paged](https://api.hubapi.com/engagements/v1/engagements/paged)  
Url=[https://api.hubapi.com/engagements/v1/engagements/paged?hapikey=\*\*\*&limit=250&offset=1581446265](https://api.hubapi.com/engagements/v1/engagements/paged?hapikey=***&limit=250&offset=1581446265)

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [April 16, 2019, 10:36pm UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/2 "2019-04-16T22:36:32Z")

</div>

Hi @JonesTrac , thanks for reaching out. We’re seeing elevated levels of 500s recently since our outage a few weeks back. I found similar posts here:

- [https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Error-GET-engagements-v1-engagements-paged/m-p/263222?collapse\_discussion=true&filter=location&location=category:developers&page=2&q=500%20error&search\_type=thread](https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Error-GET-engagements-v1-engagements-paged/m-p/263222?collapse_discussion=true&filter=location&location=category:developers&page=2&q=500%20error&search_type=thread)
- [https://community.hubspot.com/t5/APIs-Integrations/500-on-diverse-API-calls/m-p/260458?collapse\_discussion=true&filter=location&location=category:developers&page=2&q=500%20error&search\_type=thread](https://community.hubspot.com/t5/APIs-Integrations/500-on-diverse-API-calls/m-p/260458?collapse_discussion=true&filter=location&location=category:developers&page=2&q=500%20error&search_type=thread)
- [https://community.hubspot.com/t5/APIs-Integrations/HTTP-500-error-when-loading-table/m-p/262641?collapse\_discussion=true&filter=location&location=category:developers&q=500%20error&search\_type=thread](https://community.hubspot.com/t5/APIs-Integrations/HTTP-500-error-when-loading-table/m-p/262641?collapse_discussion=true&filter=location&location=category:developers&q=500%20error&search_type=thread)

We’re actively looking into the issue at the moment, though to be transparent, 500 errors are hard for us to track since they don’t normally reach our filters that catch errors. Have you tried retrying the requests? This normally clears up issues like this right away and in theory, you should always retry 500 errors.

That said, as I said we’ve seen more of these errors recently and are looking into it.

---

<div class="post-metadata">

**Author:** ![JonesTrac](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jonestrac/32/1529_2.png) [@JonesTrac](https://community.hubspot.com/u/JonesTrac)\
**Post date:** [April 18, 2019, 3:56pm UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/3 "2019-04-18T15:56:30Z")

</div>

Hi Connor, I’m doing my best to implement retrying but it doesn’t always work. Can you give any update on tracing the errors on your end? If a lot of people are experiencing this since the outage it does look like that is the root cause

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [April 18, 2019, 4:10pm UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/4 "2019-04-18T16:10:36Z")

</div>

Hi @JonesTrac we’re digging into this with the product team now. We’ll let you know when we have more info. Thanks

---

<div class="post-metadata">

**Author:** ![JonesTrac](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jonestrac/32/1529_2.png) [@JonesTrac](https://community.hubspot.com/u/JonesTrac)\
**Post date:** [April 29, 2019, 11:55am UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/5 "2019-04-29T11:55:35Z")

</div>

Hi Conor, this is still happening frequently and causing disruption. Is there any update on a fix?

Many Thanks,

Owen

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [April 29, 2019, 3:58pm UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/6 "2019-04-29T15:58:17Z")

</div>

nothing yet, @JonesTrac - you’ll be the first to know when we get more info.

---

<div class="post-metadata">

**Author:** ![ahoekstra](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ahoekstra/32/35493_2.png) [@ahoekstra](https://community.hubspot.com/u/ahoekstra)\
**Post date:** [May 5, 2019, 5:35am UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/7 "2019-05-05T05:35:54Z")

</div>

I can also confirm retrying _sometimes_ works, sometimes doesn’t. Even up to 5 retries with delays in between. 500 Internal Errors with no other explanation. It’s maddening. Can we please get an update?

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [May 5, 2019, 11:34pm UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/8 "2019-05-05T23:34:04Z")

</div>

Hi @ahoekstra , thanks for the response on this thread, our engineers made some more changes this past week that look promising, but apparently didn’t clear up all errors. The issue is that we’re running into resource allocation issues when scaling up this service.

When did you run into those 500 errors?

---

<div class="post-metadata">

**Author:** ![ahoekstra](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ahoekstra/32/35493_2.png) [@ahoekstra](https://community.hubspot.com/u/ahoekstra)\
**Post date:** [May 6, 2019, 12:25pm UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/9 "2019-05-06T12:25:19Z")

</div>

Hello, I’m sure they’re still occuring. I last captured a log on Sat, May 4. It contains the raw communication of what we’re sending and the errors being thrown. A few examples of the responses:

{“status”:“error”,“message”:“internal error”,“correlationId”:“458d7e21-7039-43f9-b91b-8c18b87652c7”,“requestId”:“871b36dcd9f33f204f718003f5c8b657”}

{“status”:“error”,“message”:“internal error”,“correlationId”:“b86cb9bd-51dc-43ef-96d6-3754e50ca75f”,“requestId”:“47d52db93cb89085c044b62441658e98”}

{“status”:“error”,“message”:“internal error”,“correlationId”:“5f713e78-a2a6-46e4-853f-cd064c01c1be”,“requestId”:“d886661595cce99e6dc2f8d39917381f”}

{“status”:“error”,“message”:“internal error”,“correlationId”:“b9c7c4bd-3709-446b-bf08-64d9dc7a225b”,“requestId”:“086f6b909c7df46a1997be76abf1d2f4”}

Also got this fun one:

{“status”:“error”,“message”:“Unknown Contacts Search API failure: [500] {\“status\”:\“error\”,\“message\”:\“internal error\”,\“correlationId\”:\“def69f26-e3ca-420a-a473-c13bc781af63\”,\“requestId\”:\“b0f237cb-c786-4a37-afae-02e0fa08c474\”}”,“correlationId”:“def69f26-e3ca-420a-a473-c13bc781af63”,“requestId”:“4e372f849856da3592a644110e88ab50”}

I can send you a full copy of the log just let me know where to email it.

Also just a thought.. if its a resource allocation issue, having people retry transactions over and over again is just going to exacerbate the problem.

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [May 6, 2019, 1:52pm UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/10 "2019-05-06T13:52:43Z")

</div>

Hi @ahoekstra , thanks for the logs! We won’t need the whole logs so thank you for the examples you gave. Much appreciated. And appreciate the insight! It’s a bit more complex than what I’m able to provide you with specifics on, but the systems should definitely be able to handle the retry efforts. I’ll update you all when I have more information.

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [May 6, 2019, 8:34pm UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/11 "2019-05-06T20:34:16Z")

</div>

hey all, looks like our engineers made some changes and are hoping this will alleviate if not fix the higher than normal rate of 500 errors. Would you be able to keep an eye out over the next day or so to see if this change has helped? It should work, as we rolled back some newer changes to fix this issue, but let me know!

Just as a heads up in general, it’s not uncommon to see a certain number of 500 errors. We usually see 99.99% success rate, so the 500 errors may not be completely removed, but the fix should bring us down to the normal 500 rate. You should continue retrying your requests if you get a 500.

---

<div class="post-metadata">

**Author:** ![JonesTrac](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jonestrac/32/1529_2.png) [@JonesTrac](https://community.hubspot.com/u/JonesTrac)\
**Post date:** [May 7, 2019, 9:16am UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/12 "2019-05-07T09:16:57Z")

</div>

Thanks for the update Connor, I will keep an eye out for any more errors. Adding a retry pattern to our query did help us

Many Thanks,

Owen

---

<div class="post-metadata">

**Author:** ![martyf5](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/martyf5/32/47092_2.png) [@martyf5](https://community.hubspot.com/u/martyf5)\
**Post date:** [May 7, 2019, 7:28pm UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/13 "2019-05-07T19:28:36Z")

</div>

[https://community.hubspot.com/t5/APIs-Integrations/HTTP-500-error-when-loading-table/m-p/268900/highlight/true#M24253](https://community.hubspot.com/t5/APIs-Integrations/HTTP-500-error-when-loading-table/m-p/268900/highlight/true#M24253)

---

<div class="post-metadata">

**Author:** ![ahoekstra](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ahoekstra/32/35493_2.png) [@ahoekstra](https://community.hubspot.com/u/ahoekstra)\
**Post date:** [May 7, 2019, 7:48pm UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/14 "2019-05-07T19:48:27Z")

</div>

It appears the 500 errors have vanished for us! Will keep an eye on it.

---

<div class="post-metadata">

**Author:** ![ahoekstra](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ahoekstra/32/35493_2.png) [@ahoekstra](https://community.hubspot.com/u/ahoekstra)\
**Post date:** [May 7, 2019, 8:01pm UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/15 "2019-05-07T20:01:17Z")

</div>

I should mention we also added retry logic. Up to 10 retries, initial delay of 2 seconds, doubling the retry wait interval after each attempt.

---

<div class="post-metadata">

**Author:** ![spirohq](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/spirohq/32/17314_2.png) [@spirohq](https://community.hubspot.com/u/spirohq)\
**Post date:** [May 20, 2019, 6:18pm UTC](https://community.hubspot.com/t/engagements-api-500-internal-server-error/13972/16 "2019-05-20T18:18:36Z")

</div>

We are having the same issue. Never been able to paginate till the end.
