I’m using a Client Credentials Exchange hook, and while it’s functioning correctly I’m seeing this error in the logs:
Code generated an uncaught exception: Error: Callback was already called.
Here’s the hook, note there’s only one invocation of cb
.
module.exports = function(client, scope, audience, context, cb) {
var access_token = {};
access_token.scope = scope;
if (context && context.body && context.body'foo']) {
access_token'https://prefix.com/foo'] = context.body'foo'];
}
cb(null, access_token);
};
Are there circumstances under which the same hook may be called twice with the same callback function, and I need to guard against that? Additionally we are also using rules - is the same callback passed to each?
Full stacktrace:
Code generated an uncaught exception: Error: Callback was already called.
at /data/sandbox/node_modules/async/dist/async.js:903:32
at /data/sandbox/node_modules/async/dist/async.js:3858:13
at /data/sandbox/lib/sandbox.js:800:36
at ensure_request_consumed (/data/sandbox/lib/sandbox.js:333:36)
at /data/sandbox/lib/sandbox.js:794:32
at /data/sandbox/node_modules/auth0-authz-rules-api/index.js:49:9
at /data/io/7298df97c3a64268970ccbc79deaac44/webtask.js:178:38
at organizationPicker (/data/io/7298df97c3a64268970ccbc79deaac44/webtask.js:176:3)
at fn (/data/sandbox/node_modules/auth0-authz-rules-api/node_modules/async/lib/async.js:638:34)
at Immediate._onImmediate (/data/sandbox/node_modules/auth0-authz-rules-api/node_modules/async/lib/async.js:554:34)
at processImmediate [as _immediateCallback] (timers.js:396:17)