Search code examples
node.jsamazon-web-servicesbotframework

Microsoft Bot Framework NodeJS V4 running on AWS Lambda 401 unauthorized error


I am trying to build a Chatbot using the MS BotFramework running Serverless at AWS Lambda.

The Bot is working with the Emulator and NGROK when no AppId and AppSecret are specified:

 var adapter = new BotFrameworkAdapter({
        appId: null,
        appPassword: null
    });

When I enable the AppId and Password:

 var adapter = new BotFrameworkAdapter({
        appId: process.env.microsoftAppID,
        appPassword: process.env.microsoftAppPassword
    });

The Emulator responds with: Cannot post activity. Unauthorized to a message

And in the logs I get this: BotFrameworkAdapter.processActivity(): 401 ERROR - Error: Unauthorized Access. Request is not authorized

I already verified the credentials with Step 2 from https://learn.microsoft.com/en-us/azure/bot-service/bot-service-troubleshoot-authentication-problems?view=azure-bot-service-4.0#issue-an-http-request-to-the-microsoft-login-service


Solution

  • The Code is working now for me. There was a new update for the npm "botbuilder" package published that fixed the problem.