You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 20, 2024. It is now read-only.
We were using botbuilder-adapter-webex and I see there was an issue where we change or added wrong tokens from Webex the application crashes. There was no way to catch the error as the throw error was after asynchronous operation and that could not be caught by try catch.
What we tried was:
constadapter=newWebexAdapter({access_token: process.env.ACCESS_TOKEN,// access token from https://developer.webex.compublic_address: process.env.PUBLIC_ADDRESS,// public url of this app https://myapp.com/secret: process.env.SECRET// webhook validation secret - you can define this yourself});adapter.registerWebhookSubscription('/api/messages');// <- Code crashes here and try catch does not help when tokens are wrongadapter.getIdentity();
What we tried was:
constadapter=newWebexAdapter({access_token: process.env.ACCESS_TOKEN,// access token from https://developer.webex.compublic_address: process.env.PUBLIC_ADDRESS,// public url of this app https://myapp.com/secret: process.env.SECRET// webhook validation secret - you can define this yourself});try{adapter.registerWebhookSubscription('/api/messages');// <- This does not helpadapter.getIdentity();}catch(err){console.error(err);}
What was the result you received?
Code crashed even with try catch.
What did you expect?
The error should be catchable on try catch or .then().catch(); so that it can be managed. If tokens expire or are changed it would simply crash the server which should not be the behavior instead it should be handled to gracefully let user decide.
Probable reason its happening:
Both registerWebhookSubscription and registerAdaptiveCardWebhookSubscription are not returning promise and throwing error asynchronously, wrapping it with a promise should fix it.
Context:
Botkit version: any version
Messaging Platform: Any
Node version: Any
Os: Any
Any other relevant information:
Try to wrap and provide solution as a pull request
pgoldweic, Akanksha-270392, Dayavats, VaniKaushik-2511, Maleeha456 and 2 more