Can't create task in coded action due to TypeError

I’m looking to create tasks in a coded action and am running into TypeErrors even though everything seems to match the API documentation. Anyone know what I’m doing wrong?

NOTE: I’m aware that there’s already a workflow action to create tasks, I need to go beyond what’s possible with that action, but can’t even get it to create a simple task to begin with.

Current action code:

Error:

TypeError: Cannot read properties of undefined (reading 'basicApi')
 at Object.exports.main (/var/task/file.js:22:61)
 at Runtime.exports.hubspot_handler [as handler] (/var/task/hubspotHandler.js:6:21)
 at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1089:29)

My code’s based off the documentation here: https://developers.hubspot.com/docs/api/crm/tasks

Hi, @tsprunk :waving_hand: Let’s see if we can get some community insight. Hey, @louischausse @LMeert, do you have any experience here?

Thank you very much! — Jaycee

Hey @Jaycee_Lewis it looks like there may be an error in the documentation. It appears that rather than:

hubspotClient.crm.objects.tasks.basicApi.create(SimplePublicObjectInput);

It should be:

hubspotClient.crm.objects.basicApi.create(“tasks”,SimplePublicObjectInput);