Engagements API 500 Internal Server Error

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”,
[
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’ (500): Internal Server Error
Details:
DataSourceKind=Web
DataSourcePath=https://api.hubapi.com/engagements/v1/engagements/paged
Url=https://api.hubapi.com/engagements/v1/engagements/paged?hapikey=***&limit=250&offset=1581446265

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:

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.

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

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

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

Many Thanks,

Owen

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

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?

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?

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.

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.

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.

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

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

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

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.

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