stackimpact-nodejs icon indicating copy to clipboard operation
stackimpact-nodejs copied to clipboard

autoProfiling: false and stop doesn't return a promise

Open petermorlion opened this issue 6 years ago • 0 comments

In the agent.js file, I see this piece of code:

if (!self.getOption('autoProfiling')) {
    return self._report(reporter, () => {
        self.isProfiling = false;

        callback();
    });
} 
else {
    self.isProfiling = false;

    if (callback) {
      callback();
    } 
    else {
        return Promise.resolve();
    }
}

Shouldn't the first block in the if-statement also be able to return a promise? I encountered this issue because I had set the autoProfiling to false, but am working with async/await. I get an error at the end of my Lambda that the callback is not a function. This is to be expected, as I didn't provide one.

I can supply a PR, but wanted to check if this was a deliberate decision.

petermorlion avatar Jan 08 '19 09:01 petermorlion