Skip to content Skip to sidebar Skip to footer

Amazon Lex And Botframework Integration Typeerror: Cannot Perform 'get' On A Proxy That Has Been Revoked At Response

I was doing a proof of concept trying to integrate BotFramework with Amazon lex and finally integrate the bot to Microsoft teams channel. The AWS-SDK is used to call the Amazon Lex

Solution 1:

This error message always means you have not awaited something that should be awaited. You can see the following line in your constructor:

await context.sendActivity(`Hi, I'm a TutorialBot. Welcome to the team ${ teamMember.givenName }${ teamMember.surname }`);

This should imply to you that sendActivity needs to be awaited, and yet you are not awaiting it in your postText callback:

await lexruntime.postText(params, function(err,data) {
    console.log("Inside the postText Method")
    if (err) console.log(err, err.stack); // an error occurredelse {
        console.log(data)
        msg = data.messageconsole.log("This is the message from Amazon Lex" + msg)
        context.sendActivity(MessageFactory.text(msg));
        //turnContext.sendActivity(msg);
    }

    console.log("Completed the postText Method")
})

You are awaiting the call to postText itself, but that doesn't do anything because postText returns a request and not a promise. And you may have noticed that you can't await anything in the callback because it's not an async function. It seems the Lex package is callback-based and not promise-based, which means it's hard to use it with the Bot Framework since the Bot Builder SDK is promise-based.

You may want to call the PostText API directly using a promise-based HTTP library like Axios: use await inside callback (Microsoft Bot Framework v4 nodejs)

Alternatively you can try creating your own promise and then awaiting that: Bot Framework V4 - TypeError: Cannot perform 'get' on a proxy that has been revoked

Post a Comment for "Amazon Lex And Botframework Integration Typeerror: Cannot Perform 'get' On A Proxy That Has Been Revoked At Response"