pipedrive / client-nodejs

Pipedrive API client for NodeJS
MIT License
205 stars 82 forks source link

TypeError: data.map is not a function #408

Closed rzuppur closed 1 year ago

rzuppur commented 1 year ago

Getting activity fields gives me this error:

TypeError: data.map is not a function
    at Function.convertToType ([...]\pipedrive\dist\ApiClient.js:949:25)
    at Function.constructFromObject ([...]\pipedrive\dist\model\Field.js:141:58)
    at Function.convertToType ([...]\pipedrive\dist\ApiClient.js:945:25)
    at [...]\pipedrive\dist\ApiClient.js:950:32
    at Array.map (<anonymous>)
    at Function.convertToType ([...]\pipedrive\dist\ApiClient.js:949:25)
    at Function.constructFromObject ([...]\pipedrive\dist\model\FieldsResponseAllOf.js:62:47)
    at Function.constructFromObject ([...]\pipedrive\dist\model\FieldsResponse.js:68:41)
    at Function.convertToType ([...]\pipedrive\dist\ApiClient.js:945:25)
    at ApiClient.deserialize ([...]\pipedrive\dist\ApiClient.js:391:24)

Example code:

import Pipedrive from "pipedrive";

const api = new Pipedrive.ApiClient();
api.authentications.api_key.apiKey = "TOKEN";

// This works
const dealFieldsApi = new Pipedrive.DealFieldsApi(api);
console.log(await dealFieldsApi.getDealFields());

// This doesn't
const activityFieldsApi = new Pipedrive.ActivityFieldsApi(api);
console.log(await activityFieldsApi.getActivityFields());
bashmach commented 1 year ago

Hi @rzuppur,

Could you please confirm that issue still persists for you and can be reproduced with latest version of SDK (at the moment is ^18.1)?

If still doesn't work for you and gives an error, please try to query the endpoint with same api_token in Postman (or any other tool) to check what response it returns to you and let us know.

rzuppur commented 1 year ago

Hi, seems to be working in the latest version!