mitodl / mitxpro

BSD 3-Clause "New" or "Revised" License
12 stars 2 forks source link

check_hubspot_api_errors function does not handle B2BOrders properly #2074

Closed mbertrand closed 3 years ago

mbertrand commented 3 years ago

https://sentry.io/organizations/mit-office-of-digital-learning/issues/1078135432/?referrer=slack

Steps to Reproduce

Create some B2B orders. .

Expected Behavior

Sometimes the order "line item" sync request sent to hubspot will be processed before the "deal" sync request, causing an "INVALID LINE ITEM" error to be logged. The check_hubspot_api_errors task on our end sifts through that log every 10 minutes, and if it finds that error for a Line object that doesn't exist (based on integratorObjectId, itself based on order id), logs the error to sentry. If it does exist, it does another resync instead.

Actual Behavior

The above works for non-B2B orders, but B2B orders don't have Line objects and their integratorObjectId values are slightly different, not matching the expected pattern. Therefore the error is always logged to Sentry instead of waiting for a retry.

sentry-io[bot] commented 3 years ago

Sentry issue: XPRO-AY