Skip to content

Commit 71094ed

Browse files
committed
Azure Function: avoid errors about context.done()
An Azure Function is supposed to either return a `Promise` or call `context.done()`, otherwise the following error will be shown: [Error] Error: Choose either to return a promise or call 'done'. Do not use both in your script. Learn more: https://go.microsoft.com/fwlink/?linkid=2097909 Since we do prefer to return a `Promise`, let's just skip the call to `context.done()`. To be sure, these error messages are only shown in the Azure Portal, when a developer deigns to turn on and look at the logs. Anyway, this _is_ an error, so let's do fix it. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent ccd0025 commit 71094ed

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

GitGitGadget/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ module.exports = async (context, req) => {
2121
status: 403,
2222
body: 'Not a valid GitHub webhook: ' + e,
2323
};
24-
context.done();
2524
return;
2625
}
2726

@@ -112,7 +111,6 @@ module.exports = async (context, req) => {
112111
context.res = {
113112
body: `Not a command: '${comment.body}'`,
114113
};
115-
context.done();
116114
return;
117115
}
118116

@@ -137,6 +135,4 @@ module.exports = async (context, req) => {
137135
body: `Caught an error: ${e.message || JSON.stringify(e, null, 2)}`,
138136
};
139137
}
140-
141-
context.done();
142138
};

0 commit comments

Comments
 (0)