Skip to content

Commit 2be4292

Browse files
committed
Fix seriesQueue
1 parent b8f25ca commit 2be4292

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

dist/auth0-authz.extension.2.13.3.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/lib/storage/contexts/seriesQueue.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,26 @@ module.exports = function seriesQueue() {
1111

1212
running = true;
1313
const task = queue.shift();
14-
task.action(function(err, res) {
14+
15+
// Handle both callback-style and Promise-returning functions
16+
const result = task.action(function(err, res) {
17+
// Callback-style: action will call this callback
1518
task.callback(err, res);
1619
next();
1720
});
21+
22+
// If action returns a Promise (doesn't use the callback), handle it
23+
if (result && typeof result.then === 'function') {
24+
result
25+
.then(function(res) {
26+
task.callback(null, res);
27+
next();
28+
})
29+
.catch(function(err) {
30+
task.callback(err);
31+
next();
32+
});
33+
}
1834
};
1935

2036
return function(action, callback) {

0 commit comments

Comments
 (0)