OfficeDev/teams-toolkit

Teams Toolkit => Prepare Teams App Dependencies throws "The operation has timed out." SystemError

Opened this issue · 8 comments

I am using Visual Studio Community 2022 (64-bit) Preview for my daily work.
image
I noticed that for a couple of bots and MS Teams apps I have, two different tenants, I am not able to start debug any more.
Everything worked properly at least couple of weeks ago (that was the last time I had to debug any of them).
I tried with deleting old dev tunnels and recreating them and then used command from the title of this post, but it failed with error shown below.
{ "errorType": "SystemError", "source": "Fx-VS", "name": "CannotConnectServerError", "message": "The operation has timed out.", "stack": " at Microsoft.VisualStudio.Threading.TplExtensions.<WithTimeout>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at TeamsFx.VisualStudio.RPC.Client.<ConnectToServerAsync>d__11.MoveNext()", "innerError": null, "userData": null, "timestamp": "2024-06-03T11:07:05.7466696+02:00", "displayMessage": "The operation has timed out.", "helpLink": null, "issueLink": null }

I manually updated BOT_ENDPOINT and BOT_DOMAIN values .env.local file but then I got error messages shown on image below (and found myself running around in circles).
image

Any help on this will be much appreciated.

NOTE:
I left a comment in closed issue #5104 that looks similar to mine.

P.S. I just tried to create new bot from echo bot template and got error like on image below.
image

@mjoksa Hi, can you help check if the server is running successfully? Do you recall if your firewall has blocked this server? TTK needs to connect to this server to generate templates and perform other tasks.

image

@xiaolang124
No such process on my machine. I reinstalled Teams Toolkit in Visual Studio 2022 Preview and same error.
I installed fresh copy of Visual Studio 2022 Community (not preview) and got same error.
Also, I turned off firewall just in case and error was there.
It looks like that for some specific reason, Teams Toolkit Server is not running on my machine.
I can confirm this in Visual Studio Output window (no Teams Toolkit Server option on image below)
image
In case we need to have a screen share session please let me know (I work from CEST time zone)

Hi, can you try starting the server directly in the terminal to see if it works? Server.exe should be in your VS installation directory. It should look something like this. ....\\Common7\IDE\Extensions\Microsoft\Teams Toolkit\server.exe

image

Hi,
Just tried it. Got an error like on image below.
image
Details of the error are copied below.
OpenSSL configuration error: 4C1A0000:error:80000005:system library:BIO_new_file:Input/output error:C:\Users\runneradmin\AppData\Local\Temp\pkg.24e0b2b2d51e47b9dba34c30\node\deps\openssl\openssl\crypto\bio\bss_file.c:67:calling fopen(C:\Program Files\OpenSSL-Win64\bin\cnf, rb) 4C1A0000:error:10080002:BIO routines:BIO_new_file:system lib:C:\Users\runneradmin\AppData\Local\Temp\pkg.24e0b2b2d51e47b9dba34c30\node\deps\openssl\openssl\crypto\bio\bss_file.c:77: 4C1A0000:error:07080002:configuration file routines:def_load:system lib:C:\Users\runneradmin\AppData\Local\Temp\pkg.24e0b2b2d51e47b9dba34c30\node\deps\openssl\openssl\crypto\conf\conf_def.c:181:

Hi, I have found a similar problem with the same error message. You can update the OPENSSL_CONF to the correct path or remove the environment variable. By the way, we will fix this issue to display the startup error in the output channel in a later version. Thanks.

https://stackoverflow.com/questions/52188224/error-starting-nodejs-openssl-config-failed
nodejs/node#40547

Removing OPENSSL_CONF made Teams Toolkit Server start as expected.
Prepare Teams App menu option now gives me another error:
`
Executing provision

Lifecycle stage: provision(9 step(s) in total). The following actions will be executed:
(1/9) Action teamsApp/create: create a Teams app.
(2/9) Action botAadApp/create: create a new or reuse an existing bot Microsoft Entra app.
(3/9) Action file/createOrUpdateJsonFile: Create or update JSON file.
(4/9) Action botFramework/create: creates or updates the bot registration on dev.botframework.com
(5/9) Action teamsApp/validateManifest: validate a Teams app.
(6/9) Action teamsApp/zipAppPackage: build a Teams app package.
(7/9) Action teamsApp/validateAppPackage: validate a Teams app.
(8/9) Action teamsApp/update: update a Teams app.
(9/9) Action file/createOrUpdateJsonFile: Create or update JSON file.

Executing lifecycle provision
Executing action teamsApp/create in lifecycle provision
Teams app with id 240cf6e1-79d9-416d-8c22-665f6391a88b already exists, skipped creating a new Teams app.
Action teamsApp/create in lifecycle provision succeeded with output {"TEAMS_APP_ID":"240cf6e1-79d9-416d-8c22-665f6391a88b","TEAMS_APP_TENANT_ID":"a4a16ac6-5ec4-4081-9867-01ddd942d88b"}
Executing action botAadApp/create in lifecycle provision
Executing action botAadApp/create
Bot Microsoft Entra app creation skipped.
Used existing Microsoft Entra application with client id 4121f3fa-dbb4-40a1-9a91-1df8a1ce84d1.
Action botAadApp/create executed successfully
Action botAadApp/create in lifecycle provision succeeded with output {"BOT_ID":"4121f3fa-dbb4-40a1-9a91-1df8a1ce84d1","SECRET_BOT_PASSWORD":"******"}
Executing action file/createOrUpdateJsonFile in lifecycle provision
Action file/createOrUpdateJsonFile in lifecycle provision succeeded with output {}
Executing action botFramework/create in lifecycle provision
Bot registration not found, create a new one.
Unable to execute action botFramework/create. Error message: Unable to make API call to Developer Portal. Check Output panel for details.
Failed to Execute lifecycle provision due to failed action: botFramework/create. DeveloperPortalAPIFailedError:Unable to make API call to Developer Portal: AxiosError, Request failed with status code 400, API name: create-bot, X-Correlation-ID: 1d0ccced-d135-4ba9-a01e-9bda5ca14ab9. This may be due to a temporary service error. Try again after a few minutes. data: "The bot name is already registered to another bot application.". Env output: {"TEAMS_APP_ID":"240cf6e1-79d9-416d-8c22-665f6391a88b","TEAMS_APP_TE...
Execution summary:

Summary:
(×) Error: Lifecycle stage provision failed.
(√) Done: teamsApp/create was executed successfully.
(√) Done: Teams app with id 240cf6e1-79d9-416d-8c22-665f6391a88b already exists, skipped creating a new Teams app.
(√) Done: botAadApp/create was executed successfully.
(√) Done: Used existing Microsoft Entra application with client id 4121f3fa-dbb4-40a1-9a91-1df8a1ce84d1.
(√) Done: file/createOrUpdateJsonFile was executed successfully.
(√) Done: The json file has been generated successfully to ./appsettings.Development.json.
(×) Error: botFramework/create failed.
(×) Error: Unable to make API call to Developer Portal: AxiosError, Request failed with status code 400, API name: create-bot, X-Correlation-ID: 1d0ccced-d135-4ba9-a01e-9bda5ca14ab9. This may be due to a temporary service error. Try again after a few minutes. data: "The bot name is already registered to another bot application."
(!) Warning: teamsApp/validateManifest was not executed.
(!) Warning: teamsApp/zipAppPackage was not executed.
(!) Warning: teamsApp/validateAppPackage was not executed.
(!) Warning: teamsApp/update was not executed.
(!) Warning: file/createOrUpdateJsonFile was not executed.

{
"errorType": "SystemError",
"source": "AppStudioPlugin",
"name": "DeveloperPortalAPIFailedError",
"message": "Unable to make API call to Developer Portal: AxiosError, Request failed with status code 400, API name: create-bot, X-Correlation-ID: 1d0ccced-d135-4ba9-a01e-9bda5ca14ab9. This may be due to a temporary service error. Try again after a few minutes. data: "The bot name is already registered to another bot application."",
"stack": "DeveloperPortalAPIFailedError: Unable to make API call to Developer Portal: AxiosError, Request failed with status code 400, API name: create-bot, X-Correlation-ID: 1d0ccced-d135-4ba9-a01e-9bda5ca14ab9. This may be due to a temporary service error. Try again after a few minutes. data: "The bot name is already registered to another bot application."\n at Object.wrapException (C:\snapshot\server\lib\index.js)\n at handleBotFrameworkError (C:\snapshot\server\lib\index.js)\n at Ap...
"innerError": {
"message": "Request failed with status code 400",
"name": "AxiosError",
"stack": "AxiosError: Request failed with status code 400\n at settle (C:\snapshot\server\lib\index.js)\n at IncomingMessage.handleStreamEnd (C:\snapshot\server\lib\index.js)\n at IncomingMessage.emit (node:events:549:35)\n at endReadableNT (node:internal/streams/readable:1359:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:82:21)\n at Axios.request (C:\snapshot\server\lib\index.js)\n at process.processTicksAndRejections (node:internal/proce...
"config": {
"transitional": {
"silentJSONParsing": true,
"forcedJSONParsing": true,
"clarifyTimeoutError": false
},
"adapter": [
"xhr",
"http"
],
"transformRequest": [
null
],
"transformResponse": [
null
],
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"maxBodyLength": -1,
"env": {},
"headers": {
"Accept": "application/json, text/plain, /",
"Content-Type": "application/json",
"Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IkwxS2ZLRklfam5YYndXYzIyeFp4dzFzVUhIMCIsImtpZCI6IkwxS2ZLRklfam5YYndXYzIyeFp4dzFzVUhIMCJ9.eyJhdWQiOiJodHRwczovL2Rldi50ZWFtcy5taWNyb3NvZnQuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvYTRhMTZhYzYtNWVjNC00MDgxLTk4NjctMDFkZGQ5NDJkODhiLyIsImlhdCI6MTcxNzU3NTg3MiwibmJmIjoxNzE3NTc1ODcyLCJleHAiOjE3MTc1ODExMzEsImFjciI6IjEiLCJhaW8iOiJBVlFBcS84V0FBQUFjMWQvb2RadnQxaHFqWFpzZ3pqQldkaVlPdFpRb0ttV2NKeHJzeDJtSmRobUFVQWJ1Z1BUWHR0akpsRmd3WTJNYmdQbS...
"Client-Source": "teamstoolkit",
"User-Agent": "axios/1.6.7",
"Content-Length": "234",
"Accept-Encoding": "gzip, compress, deflate, br"
},
"method": "post",
"url": "https://dev.teams.microsoft.com/emea/api/botframework",
"data": "{"botId":"4121f3fa-dbb4-40a1-9a91-1df8a1ce84d1","name":"Aiden.MsTeams.Bot","description":"","iconUrl":"","messagingEndpoint":"https://k16mmdc2-5130.euw.devtunnels.ms/api/messages\",\"callingEndpoint\":\"\",\"configuredChannels\":[\"msteams\"]}"
},
"code": "ERR_BAD_REQUEST",
"status": 400
},
"userData": null,
"timestamp": "2024-06-05T08:34:32.285Z",
"displayMessage": "Unable to make API call to Developer Portal. Check Output panel for details.",
"helpLink": null,
"issueLink": null
}
`
It states that bot name is already in use, but again, this menu option worked in the past (whenever I decided to change dev tunnel).
I am able to start bot locally in debug mode, but no breakpoints are hit.
Do I really need to delete old app registration and start with new one?

It looks like bot name (Aiden.MsTeams.Bot) is wrong as suffix 'local' (from .env.local file) is not added and I already have app registration with that name for bot deployed in Azure.

I had to delete old app registration (that I used for debug) in MS Entra and recreate it via Prepare Teams App menu in order to make everything work as expected.
As far as I am concerned the issue is now resolved and can be closed.