pirateandfox / infusionsoft-javascript-api

A Javascript Library for the XML-RPC Infusionsoft API
Other
6 stars 3 forks source link

Error After Instantiating Infusionsoft #10

Open SSICWeb opened 2 years ago

SSICWeb commented 2 years ago

Hello,

I receive the below error after instantiating DataContext with my Infusionsoft token.

const infusionsoft = new api.DataContext(${infusionAccessToken});

This works correctly when I use the no longer maintained infusionsoft-api library. I'm importing the library rather than using require because it is not defined in my ES module scope (this may not have any bearing on the issue).

Do you have any ideas? It's really odd as I'm not doing anything out of the norm and it works with the older library. The older library is returning an error when returning a promise, but you can access the API.

Console error:

\node_modules\infusionsoft-javascript-api\lib\Queryable.js:10 .class('Queryable') .define({ ^

TypeError: require(...).class is not a function at Object. (C:\Users\steve\projects\mos\node_modules\infusionsoft-javascript-api\lib\Queryable.js:10:7) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (C:\Users\steve\projects\mos\node_modules\infusionsoft-javascript-api\lib\DataContext.js:1:17) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)

SSICWeb commented 2 years ago

When using ContactService with the old library it returns a promise:

Infusionsoft Data Context: Promise { promiseDispatch: [Function (anonymous)], valueOf: [Function (anonymous)], inspect: [Function (anonymous)] }

However, when I try to return a result with .done(result => { console.log(result) }) it gives an error:

Error: getaddrinfo ENOTFOUND gkcx3ekkxtjacabqty0rgma2exgb.infusionsoft.com at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) { errno: -3008, code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'gkcx3ekkxtjacabqty0rgma2exgb.infusionsoft.com' }

I know you are not maintaining that library, but I wanted to show that it was partially working with my setup.

mkalygin commented 1 month ago

@SSICWeb this is caused by the typedef package upgrade in f90c0cf7c6c95087dbaf1a1df2bf2e9d3b107f90. Do npm install infusionsoft-javascript-api@0.3.1 and it should work.