hey,
why u make it not easy testing/debugging with local nodemon? so u find faster the errors in serverless functions.
create a local index.js file called index.js:
const hubspot = require("@hubspot/api-client");
const API_KEY = 'xxx' // portal api key for testing
const hubspotClient = new hubspot.Client({ apiKey: API_KEY });
const headers = {
"Content-Type": "application/json"
}
const BASE_URL = 'https://api.sandbox.smartrecruiters.com'
function sendResponse (message) {
console.log(message)
}
async function serverless (params = {}) {
const response = await hubspotClient.crm.objects.basicApi.getById("mycustomobject", id, ["myproperty"])
return response
sendResponse({
response,
statusCode: 200
});
}
serverless({})
now on your local machine where the index.js is localed type: “npm i nodemon @hubspot/api-client”
after nodemon is installed u can type “nodemon index.js”. later u can copy/past this script to your functions folder easily
now u see a detailed error messages from hubspot client.
i think your current code have some errors in initialize process of the hubspot client.
update: with my example i have to update current hubspot client, because i have the old v2 not current v3