Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 500s from V3 Deals #139

Merged
merged 2 commits into from
Dec 10, 2020
Merged

Fix 500s from V3 Deals #139

merged 2 commits into from
Dec 10, 2020

Conversation

luandy64
Copy link
Contributor

@luandy64 luandy64 commented Dec 9, 2020

Description of change

In order to get the extra fields from the V3 Deals API, we make a POST with (up to) 100 Deal ids and the hs_date_entered_*, hs_date_exited_*, and hs_time_in_* fields marked as selected.

The shape of this POST body is:

{
  "inputs" : [<deal ids>],
  "properties": [<fields>]
}

However, this properties list can get too long and Hubspot will return a 500.

In testing, I noticed that:

  • If you leave out the properties key, then some default set of fields is returned
  • If you ask for any other field, then every non-null field on that deal is returned
  • If you ask for a field that does not exist on the deal, then you get back <key> : null

Also in testing, I noticed that asking for more than 1000 properties may or may not return a 500. But looking at the response (and this is dependent on the Hubspot account) most of the fields are null anyway. So we are asking for too much.

This PR reduces the "ask" down to just one field to leverage the second bullet above.

Manual QA steps

  • Ran the tap and confirmed we get a 500
  • Ran the tap, asking for 1000 fields, saved the records
  • Ran the tap, asking for 1 field, saved the records
  • Compared the two sets of records and noticed the fields are mostly the same
    • hs_time_in_* fields were slightly higher on the second set of records, but that makes sense as time has advanced
    • Only hs_time_in_* fields differed in my testing

Risks

  • Moderate. This is an undocumented feature of the API. Though, this is only an issue if you have a ton of deal stages

Rollback steps

  • revert this branch

@luandy64 luandy64 merged commit b09675b into master Dec 10, 2020
@luandy64 luandy64 deleted the fix-deals-500 branch December 10, 2020 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants