eCommerce Bridge is silently failing

SOLVE
Regular Contributor
I have attempted to sync a contact, deal, product and line item into HubSpot via the eCommerce Bridge sync API end point: /extensions/ecomm/v1/sync-messages/{objectType}
 
NOTE - the data that we attempted to sync is illustrated in the code snippet at the end of this message.
 
The problem we experience is that the data is all created in HubSpot except for the line item.  The line item is not created in HubSpot.
 
Subsequently, we have now found that if we send through a value of 0 (zero) through as the tax rate, instead of NULL as is illustrated in the code below, then the line item is created in HubSpot.
 
Our big concern here is that if we make a call to the sync errors endpoint to check if the sync worked, /extensions/ecomm/v1/sync-errors, it is not coming back with any errors related to this line item.  It therefore appears that HubSpot is silently failing to insert the line item and is not informing us of the error.
 
Please let me know if this makes sense and if you are able to help us get to the bottom of this?
 
{
	"contacts": [
		[{
			"id": "BABETTE",
			"firstname": "Babette Beyers",
			"email": "babette.beyers@mpull.com",
			"phone": "732142464",
			"mobilephone": "",
			"phone_2": "",
			"phone_3": "",
			"birthday": "",
			"address": "E705 The Quadrant, Wilderness road, Clar",
			"address_2": "E705 The Quadrant, Wilderness road, Clar",
			"address_3": "Claremont",
			"zip": "7708",
			"city": "Cape Town",
			"state": "Western Cape",
			"country": "ZA",
			"company": "MPULL",
			"hs_lead_status": "Not Converted",
			"createdate": "2019-04-23 17:11:08",
			"closedate": "",
			"recent_deal_close_date": "",
			"customer_status": "New",
			"customer_profile": "Retail",
			"currency": "GBP"
		}]
	],
	"products": [
		[{
			"id": "ROLLSROY-72609223589",
			"name": "Car cover, exterior",
			"description": "Car cover, exterior",
			"marque_name": "Rolls Royce",
			"product_id": "ROLLSROY-72609223589",
			"product_number": "72609223589",
			"product_url": "https:\/\/www.scuderiacarparts.com\/part\/226237\/rollsroyce\/72609223589\/car-cover-exterior.html",
			"product_image_url": "https:\/\/www.scuderiacarparts.com\/images\/diagrams\/rollsroyce\/34EUXLNB4GNYF6XMJSJ3Q3RX5.gif",
			"fitment_model_1": "Phantom",
			"fitment_model_2": "",
			"fitment_model_3": "",
			"fitment_model_4": "",
			"fitment_model_5": "",
			"manufacturer": "Rolls Royce",
			"abandoned_cart_url": "https:\/\/www.scuderiacarparts.com\/?abp=eJyLdMqrLMtKiipyLXPzK%2Fc09XD29jUOtLX1Tk0uiijKTIlKrjIOTaoIAgAfKA39",
			"online_price_gbp": 959.06,
			"online_price_usd": 1253.32,
			"online_price_eur": 1107.07,
			"order_log": "Not in stock"
		}]
	],
	"deals": [
		[{
			"id": "Q00078094",
			"dealname": "Q78094-2",
			"family": "OEM",
			"marque": "Rolls Royce",
			"stock_type": "Back To Back",
			"dealtype": "Dropped Orders",
			"currency": "GBP",
			"dealstage": "checkout_abandoned",
			"amount": 1043.19,
			"gbp_amount": 1043.19,
			"abandoned_cart_url": "https:\/\/www.scuderiacarparts.com\/?abp=eJxL8Tf0MnQqjMrxLQwwCkjPNMt2yioNtLV1d3IsyXNxyytM9g4s80nPAAAKmw1r",
			"discount_amount": "0",
			"createdate": "2019-04-23 17:31:04",
			"convert_date": "",
			"contacts": "BABETTE",
			"lineItems": [{
				"id": "Q00078094LINE000",
				"name": "Car cover, exterior",
				"quantity": 1,
				"price": 959.06,
				"amount": 959.06,
				"discount": "0",
				"tax": null,
				"deal": "Q00078094",
				"product": "ROLLSROY-72609223589"
			}]
		}]
	]
}
Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
HubSpot Moderator

Hi, @rowan-reid.

 

Thanks for clarifying! Apologies for the delayed response.

 

I was able to reproduce this behavior with a null value for tax in my account.

 

However, since the sync messages endpoint already returns a 400 error, I would not expect the Get sync errors endpoint to return the same error. The latter endpoint's documentation states that it will return errors from "previously processed sync messages," indicating those which return a 204, and the following error types:

  • INACTIVE_PORTAL
  • NO_SYNC_SETTINGS
  • SETTINGS_NOT_ENABLED
  • NO_MAPPINGS_DEFINED
  • MISSING_REQUIRED_PROPERTY
  • NO_PROPERTIES_DEFINED
  • INVALID_ASSOCIATION_PROPERTY
  • INVALID_DEAL_STAGE
  • INVALID_EMAIL_ADDRESS
  • INVALID_ENUM_PROPERTY
  • UNKNOWN_ERROR

Thus, since "Invalid input" errors are already triggered by the sync messages endpoint, they are not returned by the Get sync errors endpoint. Sorry for the confusion and back-and-forth.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
11 Replies 11
HubSpot Moderator

Hi, @rowan-reid.

 

To confirm, is the sync message endpoint returning a 204 response for line item Q00078094LINE000, yet you are not seeing the line item appear on deal Q00078094?

 

Could you share the Hub ID you are operating in and what is returned when you query this sync status endpoint for line item Q00078094LINE000?

 

Do you receive something like this?

 

 

{
    "storeId": "default",
    "objectType": "LINE_ITEM",
    "externalObjectId": "Q00078094LINE000",
"hubspotId": 139700059,
"lastProcessedAt": 1558036882621,
"errors": []
}

 

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
Regular Contributor

Hi @IsaacTakushi 

 

Thanks for your reply.  The portal ID is 4059778

 

Here is the data we are trying to sync:

 

1. Deal Array Data to Sync.PNG1.2 Deal Line Item Array Data to Sync With Incorrect Tax Type.PNG

 

Then the sync endpoint comes back with this error:

"{"status":"error","message":"Invalid input JSON on line 1, column 312: Instantiation of [simple type, class com.hubspot.sync.core.messages.SyncMessageRequest] value failed (java.lang.NullPointerException): propertyNameToValues value","correlationId":"1446dbcd-17a9-41d0-8fdb-9692094808b5","requestId":"86f2cb07dbc5d284345ec53430f6c0f0"}"

 

Then we find our deal was created without the line item:

2. Deal created without line item.PNG

 

 

Reply
0 Upvotes
HubSpot Moderator

Hi, @rowan-reid.

 

Thanks for this information.

 

When I've seen that "Invalid input JSON on line 1" error before, it's been because some field was missing in the JSON payload.

 

Would you mind printing and sharing the actual JSON you are generating and sending to the sync message endpoint?

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
Regular Contributor

Hi @IsaacTakushi 

 

Here is an example of the JSON sent through:

 

"[{"integratorObjectId":"lineItem201905232126","action":"UPSERT","changeOccurredTimestamp":1558640012,"propertyNameToValues":{"hs_assoc__product_id":"scprod201905071450","hs_assoc__deal_id":"dealId201905232133","name":"TEST SideClick dealId201905232133 lineItem201905232126 scprod201905071450 Line Item 1","quantity":1,"price":"100","amount":100,"discount":10,"tax":null}}]"

Here is the response we get:

"{"status":"error","message":"Invalid input JSON on line 1, column 371: Instantiation of [simple type, class com.hubspot.sync.core.messages.SyncMessageRequest] value failed (java.lang.NullPointerException): propertyNameToValues value","correlationId":"6326c95b-e05a-48bb-8992-f4959cfbe210","requestId":"6517d7085c61fbcd562238cc0c8e0ab3"}"

The error no longer happens if we switch the 'tax' value to an integer.

Reply
0 Upvotes
HubSpot Moderator

Hi, @rowan-reid.

 

Apologies for the delayed response. Thank you for providing that example in JSON.

 

The error message (and the one you shared before) indeed indicates a problem with instantiating the null value.

 

To confirm, are you saying that the Check the sync status of an object endpoint returns the more helpful NullPointerException error while the Get all sync errors for an app endpoint — which you use — shows no errors?

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
Regular Contributor

Hi @IsaacTakushi 

 

Thanks.  That error is being returned from the Sync Messages end point:

 

/extensions/ecomm/v1/sync-messages/{objectType}

 

We are not making use of the "Check Sync Status" end point in our implementation at all. 

 

Yes, the "Get all Sync errors" method is not returning any errors.

 

Regards,

Rowan

Reply
0 Upvotes
HubSpot Moderator

Hi, @rowan-reid.

 

Thanks for clarifying! Apologies for the delayed response.

 

I was able to reproduce this behavior with a null value for tax in my account.

 

However, since the sync messages endpoint already returns a 400 error, I would not expect the Get sync errors endpoint to return the same error. The latter endpoint's documentation states that it will return errors from "previously processed sync messages," indicating those which return a 204, and the following error types:

  • INACTIVE_PORTAL
  • NO_SYNC_SETTINGS
  • SETTINGS_NOT_ENABLED
  • NO_MAPPINGS_DEFINED
  • MISSING_REQUIRED_PROPERTY
  • NO_PROPERTIES_DEFINED
  • INVALID_ASSOCIATION_PROPERTY
  • INVALID_DEAL_STAGE
  • INVALID_EMAIL_ADDRESS
  • INVALID_ENUM_PROPERTY
  • UNKNOWN_ERROR

Thus, since "Invalid input" errors are already triggered by the sync messages endpoint, they are not returned by the Get sync errors endpoint. Sorry for the confusion and back-and-forth.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
Highlighted
Regular Contributor

Hi @IsaacTakushi ,

 

Thanks very much for the response, that makes sense.  Is it documented anywhere how we can expect error messages to come back from the  sync messages call?  That particular page of documentation does not make reference to 400 being an expected response code and under what conditions?

 

Kind Regards,
Rowan

Reply
0 Upvotes
HubSpot Moderator

Hi, @rowan-reid.

 

You're absolutely right — the Sync messages article doesn't mention 400 errors at all.

 

To be frank, much of our documentation currently lacks the expected range of error codes, and for that, I apologize.

 

Our product team is working to completely overhaul our current documentation. In the not-too-distant future, we expect our docs to adhere to the OpenAPI Specification v3 (OAS 3), which should make troubleshooting error codes much easier.

 

In the meantime, I'll be sure to share your pain internally.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
Regular Contributor

Hi @IsaacTakushi,

 

Thanks very much, I appreciate that.  I reckon this answers everything that we can answer on this for now, thanks again for your assistance.

 

Kind Regards,

Rowan

Reply
0 Upvotes
HubSpot Moderator

Happy to help, @rowan-reid!

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes