APIs & Integrations

BiG
Contributeur

502 Bad Gateway errors

We are synchronizing contacts to Hubspot all-day long. We are constantly updating them to keep our information consistent with our system.

Every now and then, we receive a 502 Bad Gateway as an answer. Currently, it happens about once a day. This is not much, seeing to number of synchonizations we do daily. But it still happens so often, I finally decided to ask in this forum about this error.

Naturally, I serve you with as much details as you need. Our id is 4918719.

Time of failure on our side (CEST): 2019-06-18 21:08:17,282

Country: Switzerland

URL: https://api.hubapi.com/contacts/v1/contact/vid/97158701/profile

Method: POST

Data in JSON:
{"properties":[{"property":"last_modified_by_system","value":"1560816000000"},{"property":"lifecyclestage","value":"lead"},{"property":"hs_language","value":"en"}]}

 

My code is made to repeat the query on a 5xx failure. It seems like the second approach worked. But this timeouts still are kind of anoying.

I hope you can help me on that.

3 Réponses
lscanlan
Ancien salarié HubSpot
Ancien salarié HubSpot

502 Bad Gateway errors

Hi @BiG,

 

These questions about 5xx errors come up every so often. We're aware that they're annoying and the usual advice we offer is to add retry logic into your app / system. If you do some searching on this forum for something like "500" you'll find some related threads about it. Here's one example that I was in recently: https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Error-GET-engagements-v1-engagements....

 

Not long ago we were seeing elevated rates of 5xx errors to CRM endpoints. Our engineers have made changes to reduce those error rates. We've added better monitoring so that we can adjust things quicker in the future, if we see those rates increase again. We are seeing better success rates recently.

 

I don't have any specifics in terms of what our engineers are doing currently, since it would require pretty in-depth knowledge of our internal systems to make sense of it. But my understanding is that there's still work being done to improve reliability. I think for now, just make sure to keep using retry logic, which it sounds like you're already doing anyway. So that when you do encounter a 5xx error, that it doesn't disprupt whatever you're doing. If you are running into enough 5xx errors that it's preventing you from using our APIs or if you're seeing a significantly increased rate of those errors, definitely reply here or create a new post about it and we'll take a look. In that case usually the full response from our API is helpful for troubleshooting.

 

Let me know if you have any questions about it.

Leland Scanlan

HubSpot Developer Support
florianxolf
Membre

502 Bad Gateway errors

Hey Leland,

thanks for your response and insights on this. As a software developer I'm pretty interested iwithn the reasons for a lot of 502s when using the Hubspot Api. Also delayed writes or maybe high lags to read databases occurs, e.g. creating a contact and search for it within the next 10 seconds does not bring up an result.

I'm thrilled to learn more about the challenges of scaling such a large system like HubSpot.

Cheers
Florian

0 Votes
dahurleysblicom
Membre

502 Bad Gateway errors

Hi,

 

I am also getting a 502 Bad Gateway. Every 500 rows or so, intermittent. I plan to add the retry logic. I have 129,000 one time mass load of Contact and Deal data to do. (no, group load of 100 Contacts won't work for me). Hopefully the retry will be suffficient.

 

Can you please inform your help desk that these errors occur on your side? Would have saved me a lot of back and forth.

 

Thanks,

Dan