I am developing a web app bot on azure (v3) and I am using async methods but I can't seem to solve an issue which is SyntaxError: Unexpected token function.
I've tried updating my nodeJS from 6.9.4 to 8.9 but that didn't work. I also ran npm i -g azure-functions-core-tools@core but still nothing.
class OAuthHelpers {
/**
* Enable the user to schedule meeting and send an email attachment via the bot.
* @param {TurnContext} turnContext
* @param {TokenResponse} tokenResponse
* @param {*} emailAddress The email address of the recipient
*/
async function createevent(turnContext, tokenResponse, emailAddress) {
if (!turnContext) {
throw new Error('OAuthHelpers.createevent(): `turnContext` cannot be undefined.');
}
if (!tokenResponse) {
throw new Error('OAuthHelpers.createevent(): `tokenResponse` cannot be undefined.');
}
var client = new SimpleGraphClient(tokenResponse.token);
// Calls the Graph API with the subject and content message...
await client.createevent(
emailAddress,
`Lunch`,
`I will be taking everyone to lunch as a reward for your hardwork.`
);
// Success message...
await turnContext.sendActivity(`Success! I have scheduled a meeting with you and ${ emailAddress } have created an event on each of their calendars.`);
}
I want the bot to run normally but it can't because azure can't detect the async function for some reason. Any help is appreciated