I have an azure function that looks a bit like this:
module.exports = async (context: Context, req: any) => {
const canProceed = await new Auth().verify(context, req);
if (!canProceed) {
context.res = {
status: 401,
body: 'Unauthorised'
};
return context.done(undefined, context);
}
context.res = doStuff();
return context.done(undefined, context);
}
When I run the function locally I get this warning or error:
Error: Choose either to return a promise or call 'done'. Do not use both in your script.
It is not clear from the docs how this should work