Hi folks.
Firstly, this is probably my general understanding of node here. I’ve extensive experience of the raw API via curl not node.
I’m finding that in even the simplest example, when invoking the okta node-js client, my node app isn’t terminating on completion and I can’t figure out why?
Given this, I’d expect the node process to exit once the then() clause is reached, but it doesn’t. Even simply instantiating the client is enough to require ctrl+c to halt.
const okta = require('@okta/okta-sdk-nodejs')
var client = new okta.Client({
orgUrl: 'https://dev-NNNNN.oktapreview.com/',
token: 'MYTOKEN'
})
client.listUsers().each(user => {
console.log(user);
})
.then(() => {
console.log('All users have been visited');
});
Can anyone comment as to why this is? From what I’ve read node will terminate when there no more work in its event queue so my assumption is that the client is maintaining an internal reference to something means that never occurs, but after several hours of head scratching, I’m stumped.
Thanks