APIs & Integrations

jjimeno
Participant | Diamond Partner
Participant | Diamond Partner

API Response

Hi, 

 

We are using this API

https://www.dbt.se/_hcms/api/associate/company/contact called through AJAX in our hubspot website. One of our test cases is to add an invalid email to make the API fail and send an error message which it did. 
When we check it printed out this response: 

 

{"error":"A server error occurred: 2020-10-01T16:39:07.319Z\tERROR\tUnhandled Promise Rejection \t{\"errorType\":\"Runtime.UnhandledPromiseRejection\",\"errorMessage\":\"ReferenceError: dataCompany is not defined\",\"reason\":{\"errorType\":\"ReferenceError\",\"errorMessage\":\"dataCompany is not defined\",\"stack\":[\"ReferenceError: dataCompany is not defined\",\"    at /var/task/test.js:51:101\",\"    at processTicksAndRejections (internal/process/task_queues.js:97:5)\"]},\"promise\":{},\"stack\":[\"Runtime.UnhandledPromiseRejection: ReferenceError: dataCompany is not defined\",\"    at process.<anonymous> (/var/runtime/index.js:35:15)\",\"    at process.emit (events.js:315:20)\",\"    at processPromiseRejections (internal/process/promises.js:209:33)\",\"    at processTicksAndRejections (internal/process/task_queues.js:98:32)\"]}\n\nMemory: 17/128 MB\nRuntime: 861.70 ms"}

 

 

Question is this something Hubspot explicitly threw or is it something we did to print this all out? If we did, then how can this be hidden? Our audit team pointed this out and just wondering if this is something we can remove since it spits out the whole stack trace.

 

Regards, 

Jess

0 Upvotes
1 Reply 1
dennisedson
HubSpot Product Team
HubSpot Product Team

API Response

hi @jjimeno !

Could you add the body of the request.  This doesnt look like the error messaging that HubSpot would provide. 

Here is simple example of what a bad request error would look like:

{
    "status": "error",
    "message": "The request is not valid",
    "correlationId": "d85d1434-480f-4b19-96ee-28b088f0cc20"
}

 

Thanks,

0 Upvotes