Hi, everyone, I have the next endpoint in mi function:
const hubspot = require('@hubspot/api-client');
exports.main = (context = {}, callback) => {
// instantiate HubSpot node API client
const hsClient = new hubspot.Client({ accessToken: "NOPE" });
// Look up contact from the API
return hsClient.crm.contacts.basicApi
.getById(1460601)
.then(resp => {
// Pass the contact properties back
callback({ results: resp.properties, body:resp });
})
.catch ((err) => {
// Handle API call error
console.error(err);
// Option 1: Return no result
callback({ results: null });
// Option 2: Rethrow the error, which will result in an ERROR status for the function call
throw err;
});
};
is a simple call to crm contacts, to get a contact by id.
But I get the error:
UNHANDLED_ERROR - Execution Time: 880msRuntime.UnhandledPromiseRejection: HttpError: HTTP request failed
I’ve looking the trouble, but I don’t what is the ploblem. I hope you can help me, thank you.