# ownersApi.getPage cannot read

**URL:** <https://community.hubspot.com/t/ownersapi-getpage-cannot-read/46706>\
**Category:** APIs & Integrations\
**Created:** [November 9, 2021, 4:26pm UTC](https://community.hubspot.com/t/ownersapi-getpage-cannot-read/46706 "2021-11-09T16:26:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PKrupa](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pkrupa/32/68815_2.png) [@PKrupa](https://community.hubspot.com/u/PKrupa)\
**Post date:** [November 9, 2021, 4:26pm UTC](https://community.hubspot.com/t/ownersapi-getpage-cannot-read/46706/1 "2021-11-09T16:26:20Z")

</div>

Hi,

I want to get userId in custom code action in Hubspot worflow.

I use hubspot API, code below:

_const hubspot = require(‘@hubspot/api-client’);_

_exports.main = async (event, callback) =\> {_

_const hubspotClient = new hubspot.Client({_  
_apiKey: process.env.HAPIKEY_  
_});_

_const email = event.inputFields[‘email’];_  
_const after = 0;_  
_const limit = 1;_  
_const archived = false;_

_try {_  
_const apiResponse = await hubspotClient.crm.owners.ownersApi.getPage(email, after, limit, archived);_  
_console.log(JSON.stringify(apiResponse.body, null, 2));_  
_} catch (err) {_  
_console.error(err);_  
_//throw err;_  
_}_

_callback({_  
_//outputFields: {_  
_// email: email_  
_// }_  
_});_  
_}_

Unfortunately when I test it I get this error:

```auto
2021-11-09T16:06:10.802Z	ERROR	TypeError: Cannot read property 'getPage' of undefined
 at Object.exports.main (/var/task/file.js:17:67)
 at Runtime.exports.hubspot_handler [as handler] (/var/task/hubspotHandler.js:6:21)
 at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)

```

Looks as if getPage method was not avilable.

I would be gratefull if someone could help me solve this problem.

---

<div class="post-metadata">

**Author:** ![MiaSrebrnjak](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/miasrebrnjak/32/10_2.png) [@MiaSrebrnjak](https://community.hubspot.com/u/MiaSrebrnjak)\
**Post date:** [November 12, 2021, 2:28pm UTC](https://community.hubspot.com/t/ownersapi-getpage-cannot-read/46706/2 "2021-11-12T14:28:07Z")

</div>

Hi @PKrupa,

I’m unfortunately not knowledgeable enough in this subject, but I wanted to tag a couple of our amazing API experts to see if they can help out:

hi @piersg, @Bryantworks, @lynton, @dannio do you have any suggestions for @PKrupa? Thank you!

Cheers  
Mia, Community Team

---

<div class="post-metadata">

**Author:** ![dalefknight](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dalefknight/32/192815_2.png) [@dalefknight](https://community.hubspot.com/u/dalefknight)\
**Post date:** [March 22, 2022, 4:13pm UTC](https://community.hubspot.com/t/ownersapi-getpage-cannot-read/46706/3 "2022-03-22T16:13:26Z")

</div>

I’m also experiencing this exact issue.

---

<div class="post-metadata">

**Author:** ![PKrupa](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pkrupa/32/68815_2.png) [@PKrupa](https://community.hubspot.com/u/PKrupa)\
**Post date:** [March 22, 2022, 5:40pm UTC](https://community.hubspot.com/t/ownersapi-getpage-cannot-read/46706/4 "2022-03-22T17:40:38Z")

</div>

Hi i got wat was cusing the problem.

Hubspot/api-client library verison ^3.4.1 (that custom code in Node.js supports) does not include ownersAPI. It was added in newer release.

I wish Hubspot team would update it soon.

Artenatively Hubspot added option to write custom code in Phyton which supports newer version 4.0.4.

> **[Workflows | Custom Code Actions - HubSpot docs](https://developers.hubspot.com/docs/api-reference/legacy/automation/workflow-actions/custom-code-actions)**
>
> Instructions for using custom code actions in workflows

---

<div class="post-metadata">

**Author:** ![MiaSrebrnjak](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/miasrebrnjak/32/10_2.png) [@MiaSrebrnjak](https://community.hubspot.com/u/MiaSrebrnjak)\
**Post date:** [March 22, 2022, 5:53pm UTC](https://community.hubspot.com/t/ownersapi-getpage-cannot-read/46706/5 "2022-03-22T17:53:49Z")

</div>

Hi @PKrupa, thank you so much for sharing this information, I’ll forward it to our team!

Cheers  
Mia, Community Team

---

<div class="post-metadata">

**Author:** ![MiaSrebrnjak](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/miasrebrnjak/32/10_2.png) [@MiaSrebrnjak](https://community.hubspot.com/u/MiaSrebrnjak)\
**Post date:** [March 23, 2022, 4:53pm UTC](https://community.hubspot.com/t/ownersapi-getpage-cannot-read/46706/6 "2022-03-23T16:53:45Z")

</div>

Actually, @PKrupa could you add this to the list of of the repo issues [here](https://github.com/HubSpot/hubspot-api-nodejs/issues)? You discovered it so the credit should go to you. 🙂

Thank you!
