我正在 azure (v3) 上开发一个 web 应用程序机器人,我正在使用异步方法,但我似乎无法解决 SyntaxError: Unexpected token function 的问题。
我尝试将我的 nodeJS 从 6.9.4 更新到 8.9,但这没有用。我也跑了 npm i -g azure-functions-core-tools@core 但仍然没有。
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.`);
}
我希望机器人正常运行,但它不能,因为 azure 由于某种原因无法检测到异步功能。任何帮助表示赞赏