Closed mwilliams1188 closed 3 years ago
Hey Mike!
I'm using this library in my own app, but I'm using ES6 imports in a browser runtime. Here's a working example that I just tested in Node 14; notice the .default
on the require statement and the fetch polyfill - I'll update the example in the readme to reflect these.
globalThis.fetch = require('node-fetch');
var OutsetaApiClient = require('outseta-api-client').default;
const outseta = new OutsetaApiClient({
subdomain: 'mycompany',
apiKey: functions.config().outseta.key,
secretKey: functions.config().outseta.secret
});
outseta.crm.accounts.getAll().then((accounts) => {
console.log(accounts);
});
Closing - let me know if you encounter any other issues!
Hi, That's weird, I'm getting this in an ES6 import:
import OutsetaApiClient from 'outseta-api-client';
const client = new OutsetaApiClient({
subdomain: 'admin-tool',
apiKey: process.env.OUTSETA_KEY,
secretKey: process.env.OUTSETA_SECRET,
});
Same error: "OutsetaApiClient is not a constructor"
@mattwebbio In fact, even using your code in Node 14 results in "Must use import to load ES Module" for node-fetch
Ah. I had to downgrade to node-fetch v2.x.x for it to work in ES5.
I'm getting the error 'OutsetaApiClient is not a constructor' when trying to initialize in firebase. Is this library ready to go? Below is my code:
`var OutsetaApiClient = require('outseta-api-client')
const outseta = new OutsetaApiClient({ subdomain: 'mycompany', apiKey: functions.config().outseta.key, secretKey: functions.config().outseta.secret })`