An error occurred sending data via webhook when creating route to ubidot api


#1

I am getting an error when routing json message reaching hologram to ubidot:

{“ruleid”:4492,“error”:true,“result_data”:“An error occurred sending data via webhook”}

See raw response below.

{“success”:true,“data”:{“id”:23722779,“logged”:“2019-03-29 03:17:00.406502”,“orgid”:21384,“deviceid”:203507,“record_id”:“1d61aca8-51d1-11e9-816c-0242ac110005”,“device_metadata”:"{“m_version”: 1, “dev_fw_string”: “novam-0.8.2”}",“data”:"{“received”: “2019-03-29T03:16:59.356445”, “authtype”: “otp”, “tags”: [“SOCKETAPI”, “camera-data”, “SIMPLESTRING”, “TAG_4251”, “DEVICE_203507”], “timestamp”: “1553829418”, “device_name”: “cc-pilot (84008)”, “errorcode”: 0, “source”: “8944502905186384008”, “record_id”: “1d61aca8-51d1-11e9-816c-0242ac110005”, “data”: “eyJzZW5zb3JfaWQiOiAiMSIsICJldmVudF90eXBlIjogInN0YXRpb25fY2FtZXJhX2F2ZXJhZ2VfbWV0cmljc19ldmVudCIsICJhX3BfYXJycmF0ZSI6IDQuMCwgInBlb3BsZV9waWNrcHJvYiI6IDAuMCwgInN0YXRpb25faWQiOiAiMSIsICJhX2NfYXJycmF0ZSI6IDAuMCwgImFfY193YWl0dGltZSI6IC0xLCAiYV9jX2NvdW50IjogMC4wLCAiYV9jX2RlcHJhdGUiOiAwLjAsICJhX3BfZGVwcmF0ZSI6IDUuMCwgImV2ZW50X3RpbWVzdGFtcCI6ICIyMDE5LTAzLTI4VDIzOjE2OjU3WiIsICJhY3Rpdml0eSI6ICJMIiwgImFfcF9jb3VudCI6IDEuMCwgImFfcF93YWl0dGltZSI6IDAuMH0=”, “device_id”: 203507}",“matched_rules”:[{“ruleid”:4382,“error”:false,“result_data”:""},{“ruleid”:4492,“error”:true,“result_data”:“An error occurred sending data via webhook”}],“tags”:[“DEVICE_203507”,“TAG_4251”,“SIMPLESTRING”,“camera-data”,“SOCKETAPI”]}}

This is the original json sent to hologram:

{“sensor_id”: “1”, “event_type”: “station_camera_average_metrics_event”, “a_p_arrrate”: 0.0, “people_pickprob”: 0.0, “station_id”: “1”, “a_c_arrrate”: 0.0, “a_c_waittime”: -1, “a_c_count”: 0.0, “a_c_deprate”: 0.0, “a_p_deprate”: 0.0, “event_timestamp”: “2019-03-28T22:45:35Z”, “activity”: “L”, “a_p_count”: 1.0, “a_p_waittime”: -1}

The route that is failing (“ruleid”:4492) is set up with the following parameter

URL

http://industrial.api.ubidots.com/api/v1.6/devices/<<device_id>>

PAYLOAD

{ “a_p_count”: <<decdata.a_p_count>>, “a_p_waittime”: <<decdata.a_p_waittime>>, “a_p_arrrate”: <<decdata.a_p_arrrate>>, “a_p_deprate”: <<decdata.a_p_deprate>>, “a_c_count”: <<decdata.a_c_count>>, “a_c_waittime”: <<decdata.a_c_waittime>>, “a_c_arrrate”: <<decdata.a_c_arrrate>>, “a_c_deprate”: <<decdata.a_c_deprate>>, “people_pickprob”: <<decdata.people_pickprob>> }

HEADERS
X-Auth-Token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json"

If I send the json payload using the curl command below.

curl -XPOST -H “x-auth-token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX” -H “content-type: application/json” -d ‘{“a_p_arrrate”: 33.0, “people_pickprob”: 0.0, “a_c_arrrate”: 0.0, “a_c_waittime”: -1, “a_c_count”: 0.0, “a_c_deprate”: 0.0, “a_p_deprate”: 34.0, “a_p_count”: 0.0, “a_p_waittime”: 0.0}’ http://industrial.api.ubidots.com/api/v1.6/devices/123456

The post is successful response from ubidot

{“a_p_arrrate”: [{“status_code”: 201}], “people_pickprob”: [{“status_code”: 201}], “station_id”: [{“status_code”: 201}], “a_c_arrrate”: [{“status_code”: 201}], “a_c_waittime”: [{“status_code”: 201}], “a_c_count”: [{“status_code”: 201}], “a_c_deprate”: [{“status_code”: 201}], “a_p_deprate”: [{“status_code”: 201}], “a_p_count”: [{“status_code”: 201}], “a_p_waittime”: [{“status_code”: 201}]}

Is there a way to get more detail on the error that hologram displays? Is it possible to see the payload being sent to ubidot? The web interface does appear to have much in the error log.

Thanks


#2

Hi, we’ll take a look through our logs today and get back to you


#3

Thanks Reuben


#4

I found your issue in the logs. There’s an error on one of the HTTP headers that you’re adding. It looks like it’s because there’s an extra space at the beginning. We’ll make a note to bubble stuff like this up to the user logs in the future.


#5

Looks like it’s on the content-type header


#6

Thanks Reuben.

Removed the leading space looks like it is working now. I wish we could have access to some lower level log view to see what is submitted and sent back to the route url.

Ben


#7

Glad that’s working.
In this case it wasn’t actually sending anything because the header issue was getting stuck in the HTTP library on our end. We are working to improve some of that visibility though and pushing up more helpful errors across various features.


closed #8

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.