DEV Community

Discussion on: ⚡ Practical Guide to Serverless Microsoft Azure Functions with JavaScript

Collapse
 
rene78 profile image
René K. • Edited

Ahmad, one more comment regarding your function. I received the error message

Error: Choose either to return a promise or call 'done'. Do not use both in your script.

Since you are using an async function there is no need to return with "context.done()" since async functions return a promise, anyway.

Right from MS Developer Guide:

When using the JavaScript async function declaration or otherwise returning a JavaScript Promise (not available with Functions v1.x), you do not explicitly need to call the context.done callback to signal that your function has completed. Your function completes when the exported async function/Promise completes.

Edit: I just saw that this is only valid for V2 of Functions. I suppose you were working on V1. Then nevermind ;)