Closed jk-msft closed 2 years ago
Thank you for contacting us! Any issue or feedback from you is quite important to us. We will do our best to fully respond to your issue as soon as possible. Sometimes additional investigations may be needed, we will usually get back to you within 2 days by adding comments to this issue. Please stay tuned.
Thanks @jk-msft for using this sample and asking questions The bot throws the 412 error, in order to let the Teams deal with this special error, then the teams will ask user to login or consent. This is expected until the user does not authorize. With the 412 error, the Teams App should display as following picture. Do you get the same result?
Hi @wenytang-ms
This is what I see in the Teams client side. Unable to reach app. Please try again.
On the Bot server side, you can see that the Bot server actually crashed.
Bot Started, restify listening to http://[::]:3978
Debugger attached.
/Users/kimjason/projects/teams-apps/pradeep-sso/query-org-user-with-message-extension-sso/bot/node_modules/botbuilder/src/botFrameworkAdapter.ts:1275
throw new Error(`BotFrameworkAdapter.processActivity(): ${status} ERROR`);
^
Error: BotFrameworkAdapter.processActivity(): 412 ERROR
at BotFrameworkAdapter.<anonymous> (/Users/kimjason/projects/teams-apps/pradeep-sso/query-org-user-with-message-extension-sso/bot/node_modules/botbuilder/src/botFrameworkAdapter.ts:1275:23)
at Generator.next (<anonymous>)
at fulfilled (/Users/kimjason/projects/teams-apps/pradeep-sso/query-org-user-with-message-extension-sso/bot/node_modules/botbuilder/lib/botFrameworkAdapter.js:12:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Waiting for the debugger to disconnect...
[nodemon] app crashed - waiting for file changes before starting...
What's your node.js version? Node.js 16 may meets such problems, you can switch Node.js 14 to run successfully. And I'm resolving this problem. I will let you know once the sample is updated.
Yes, my node is 16.
$ node -v
v16.16.0
I'll try Node 14.
Even with Node 14, I am running into the same issue. Notice that I am now using v14.20.1
but the error still happens.
* Executing task: npm run dev:teamsfx
> QueryOrgUserWithMESSO@1.0.0 dev:teamsfx /Users/kimjason/projects/teams-apps/pradeep-sso/query-org-user-with-message-extension-sso/bot
> which node; node -v; env-cmd --silent -f .env.teamsfx.local npm run dev
/Users/kimjason/.nvm/versions/node/v14.20.1/bin/node
v14.20.1
> QueryOrgUserWithMESSO@1.0.0 dev /Users/kimjason/projects/teams-apps/pradeep-sso/query-org-user-with-message-extension-sso/bot
> nodemon --exec node --inspect=9239 --signal SIGINT -r ts-node/register ./index.ts
[nodemon] 2.0.20
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: ts,json
[nodemon] starting `node --inspect=9239 -r ts-node/register ./index.ts`
Debugger listening on ws://127.0.0.1:9239/ffa14e4b-bfe9-4e32-b212-fd70ad528601
For help, see: https://nodejs.org/en/docs/inspector
Bot Started, restify listening to http://[::]:3978
Debugger attached.
(node:54517) UnhandledPromiseRejectionWarning: Error: BotFrameworkAdapter.processActivity(): 412 ERROR
at BotFrameworkAdapter.<anonymous> (/Users/kimjason/projects/teams-apps/pradeep-sso/query-org-user-with-message-extension-sso/bot/node_modules/botbuilder/src/botFrameworkAdapter.ts:1275:23)
at Generator.next (<anonymous>)
at fulfilled (/Users/kimjason/projects/teams-apps/pradeep-sso/query-org-user-with-message-extension-sso/bot/node_modules/botbuilder/lib/botFrameworkAdapter.js:12:58)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:54517) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:54517) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
hi @jk-msft you can do as following steps to bypass this issue no matter with node 16 or node 14
Update the code in bot/index.ts
around line 51
// Listen for incoming requests.
server.post("/api/messages", async (req, res) => {
await adapter.processActivity(req, res, async (context) => {
await bot.run(context);
}).catch((err) => {
if(!err.message.includes("412")) {
throw err;
}
})
});
This is just a workaround for now, we will do it in a more appropriate way in the future
@wenytang-ms , Thanks. This solution worked well for me for now. Feel free to close the ticket.
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
Org User Search Connector
Run And Debug
withDebug (Edge)
.Add
forQueryOrgUserWithMESSO
app.Expected behavior The bot should not crash in VSCode terminal
Screenshots
VS Code Extension Information (please complete the following information):
CLI Information (please complete the following information):
Additional context Add any other context about the problem here.