Open yozachar opened 1 year 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.
I've tried using devtunnel
:
$ devtunnel host -p 8080
Hosting port: 8080
Connect via browser: https://EXAMPLE-ID.asse.devtunnels.ms:8080, https://EXAMPLE-ID-8080.asse.devtunnels.ms
Inspect network activity: https://EXAMPLE-ID-8080-inspect.asse.devtunnels.ms
Ready to accept connections for tunnel: rxt2jbxd
env/.env.local
BOT_DOMAIN=EXAMPLE-ID-8080.asse.devtunnels.ms
BOT_ENDPOINT=https://EXAMPLE-ID-8080.asse.devtunnels.ms
Then teamsfx provison
, deploy
and preview
but preview
fails with the same error.
@joe733 , from your error log there's something like Run Command: The log of this task can be found in: \<some-path>, e.g.,
$ teamsfx preview --env local ... Run Command: The log of this task can be found in: /home/us-er/.fx/cli-log/local-preview/2023-07-17T05_44_23_568Z/Run-Command.log ...
Could you please check that log file and see if there's any detailed error message?
Well yes, that's what I put in the additional context
section. Here's today's
$ teamsfx preview --env local --verbose
████████████████████ 100% | [1/1] Microsoft 365 Account (✖) Done.
Microsoft 365 Account (example-user@XXvsms.onmicrosoft.com) is logged in and sideloading enabled
Option 'run-command' is not provided, set to: npm run dev:teamsfx
Run Command: Working folder - /home/us-er/TeamsApp/epitoma
Run Command: Executing command - npm run dev:teamsfx
Run Command: Running pattern - /started|successfully|finished|crashed|failed/i
Run Command: The log of this task can be found in: /home/us-er/.fx/cli-log/local-preview/2023-07-18T07_27_38_928Z/Run-Command.log
(x) Error: TeamsfxCLI.RunCommandFailed: Task 'Run Command' failed.
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 0% | [1/1] Run Command: npm run dev:teamsfx (✖) Failed.
(x) Error: TeamsfxCLI.RunCommandFailed: Task 'Run Command' failed.
$ cat /home/us-er/.fx/cli-log/local-preview/2023-07-18T07_27_38_928Z/Run-Command.log
npm run dev:teamsfx
Well yes, that's what I put in the
additional context
section. Here's today's$ teamsfx preview --env local --verbose ████████████████████ 100% | [1/1] Microsoft 365 Account (✖) Done. Microsoft 365 Account (example-user@XXvsms.onmicrosoft.com) is logged in and sideloading enabled Option 'run-command' is not provided, set to: npm run dev:teamsfx Run Command: Working folder - /home/us-er/TeamsApp/epitoma Run Command: Executing command - npm run dev:teamsfx Run Command: Running pattern - /started|successfully|finished|crashed|failed/i Run Command: The log of this task can be found in: /home/us-er/.fx/cli-log/local-preview/2023-07-18T07_27_38_928Z/Run-Command.log (x) Error: TeamsfxCLI.RunCommandFailed: Task 'Run Command' failed. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 0% | [1/1] Run Command: npm run dev:teamsfx (✖) Failed. (x) Error: TeamsfxCLI.RunCommandFailed: Task 'Run Command' failed. $ cat /home/us-er/.fx/cli-log/local-preview/2023-07-18T07_27_38_928Z/Run-Command.log npm run dev:teamsfx
So there's only one line in Run-Command.log
... It's weird.
What if you directly run npm run dev:teamsfx
?
The program launches local instance, normally.
$ npm run dev:teamsfx
> epitoma@1.0.0 dev:teamsfx
> env-cmd --silent -f .localConfigs npm run dev
> epitoma@1.0.0 dev
> nodemon --exec node --inspect=9239 --signal SIGINT -r ts-node/register ./src/index.ts
[nodemon] 2.0.22
[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 ./src/index.ts`
Debugger listening on ws://127.0.0.1:9239/7a9d704f-9dae-4132-b353-13fafa937c4f
For help, see: https://nodejs.org/en/docs/inspector
(node:30338) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Bot Started, restify listening to http://[::]:3978
As workaround, please:
npm run dev:teamsfx
first to ensure local instance is runningteamsfx preview --env local --run-command ""
- passing empty value as run-command to skip running by teamsfxFor the original error, just a guess - npm log (stdout?, stderr?) is not correctly detected by teamsfx so the run command part times out. Need more investigation and repro.
The workaround well.. works. Thanks!
Here's my repo https://gitea.com/joe733/epitoma
For the original error, just a guess - npm log (stdout?, stderr?) is not correctly detected by teamsfx so the run command part times out.
Or not properly reading from package.json
?
It works well on my Windows machine. I'll try your repo on a Linux machine.
BTW, since the working folder and run command look correct, it should already read package.json
.
The workaround well.. works.
Not quite the way I figured.
In terminal 1:
$ devtunnel host -p 3978
Hosting port: 3978
Connect via browser: https://rjb9td35-3978.asse.devtunnels.ms
Inspect network activity: https://rjb9td35-3978-inspect.asse.devtunnels.ms
Ready to accept connections for tunnel: rjb9td35
Edited the env/.env.local
to include:
BOT_DOMAIN=rjb9td35-3978.asse.devtunnels.ms
BOT_ENDPOINT=https://rjb9td35-3978.asse.devtunnels.ms
In terminal 2:
$ npm run dev:teamsfx
> epitoma@1.0.0 dev:teamsfx
> env-cmd --silent -f .localConfigs npm run dev
> epitoma@1.0.0 dev
> nodemon --exec node --inspect=9239 --signal SIGINT -r ts-node/register ./src/index.ts
[nodemon] 2.0.22
[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 ./src/index.ts`
Debugger listening on ws://127.0.0.1:9239/7a9d704f-9dae-4132-b353-13fafa937c4f
For help, see: https://nodejs.org/en/docs/inspector
(node:30338) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Bot Started, restify listening to http://[::]:3978
In terminal 3:
$ teamsfx preview --env local --run-command ""
████████████████████ 100% | [1/1] Microsoft 365 Account (✖) Done.
Microsoft 365 Account (example-user@XXvsms.onmicrosoft.com) is logged in and sideloading enabled
Teams web client is being launched for you to preview the app: https://teams.microsoft.com/l/app/BOT_ID?installAppPackage=true&webjoin=true&appTenantId=TENANT_ID&login_hint=example-user%40XXvsms.onmicrosoft.com
████████████████████ 100% | [1/1] preview (✖) Done.
(!) Warning: If you changed the manifest file, please run 'teamsfx provision --env local' to install app again.
$
The last command in terminal 3
, does launch the bot in the browser, but then there's is no activity in the HTTPS tunnel. The bot is supposed to console.log
stuff, but I cannot see that on terminal 2
.
After setting BOT_DOMAIN
and BOT_ENDPOINT
in env/.env.local
, could you please run teamsfx provision --env local
again?
To verify, you can view your bot registration on dev.botframework.com/bots?id=
So after teamsfx provision --env local
I can see my app on dev.teams.microsoft.com/app
but not on portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
Is that expected?
There should be an AAD app on App registration.
Since you are able to see your teams app on dev.teams.microsoft.com/app
, can you also check if you can see the bot on dev.teams.microsoft.com/bots
?
Yes, I see the bot and the endpoint.
But tunnel still unresponsive (and portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
is still empty).
I've not made any change to the code yet:
$ git remote -v
origin https://gitea.com/joe733/epitoma.git (fetch)
origin https://gitea.com/joe733/epitoma.git (push)
$ git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
I tried your repo from a clean state, and the app finally worked.
Still cannot repro the "Run Command" issue, but workaround works.
Since you are using devtunnel, please use parameter --allow-anonymous
, e.g., devtunnel host -p 3978 --protocol http --allow-anonymous
. Teams connects to your bot code via it's own Bot Authentication, so tunnel auth may break the bot auth.
For AAD App, please find it under "All applications" with BOT_ID.
So after
teamsfx provision --env local
I can see my app ondev.teams.microsoft.com/app
but not on
portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
Is that expected?
@joe733 For the problem that the AAD app does not show in your Owned applications
tab, this should be an issue in Microsoft Graph API. We will report this for a fix. As you already have the client id and client secret, this issue won't impact your application. Please use the All applications
tab to find related applications when needed.
Thanks @swatDong & @blackchoey.
So just to wrap up, I was able to get the bot working with the following steps.
$ # Console 1: Create Project `AwesomeTeamsApp`
$ teamsfx new
$ cd AwesomeTeamsApp
$ teamsfx account login
$ # Console 2: Start tunnel
$ devtunnel host -p 3978 --protocol http --allow-anonymous
...
$ # Console 1: Edit environment variables
$ nano env/.env.local
BOT_DOMAIN=EXAMPLE-ID-PORT.asse.devtunnels.ms
BOT_ENDPOINT=https://EXAMPLE-ID-PORT.asse.devtunnels.ms
$ # Console 3: Run npm script
$ npm run dev:teamsfx
...
$ # Console 1: Launch AwesomeTeamsApp
$ teamsfx provision --env local
$ teamsfx deploy --env local
$ teamsfx preview --env local --run-command ""
Activity can bee seen in the tunnel.
Hosting port: 3978
Connect via browser: https://EXAMPLE-ID-3978.asse.devtunnels.ms
Inspect network activity: https://EXAMPLE-ID-3978-inspect.asse.devtunnels.ms
Ready to accept connections for tunnel: EXAMPLE-ID
ClientSSH: Channel forwarder closed connection.
ClientSSH: Channel forwarder closed connection.
and the bot is responding via console logs:
Bot Started, restify listening to http://[::]:3978
Received user input
No of attachments: 2
Asynchronous processing
Handling attachment of class: 'application/vnd.microsoft.teams.file.download.info' & of type: 'txt'
Handling attachment of class: 'text/html' & of type: 'txt'
Attachment class: 'text/html' & of type: 'txt' isn't supported
==> Attempting to download: sample.txt of class: 'application/vnd.microsoft.teams.file.download.info' & of type: 'txt'
==> Download Source: https://XXvsms-my.sharepoint.com/personal/example-user_XXvsms_onmicrosoft_com/Documents/Microsoft Teams Chat Files/sample.txt
==> Download Error: 401 Unauthorized
==> Skipping unsupported attachment
Awaiting next user input
Also yes, I'm able to see bot under All applications
tabs on Azure portal.
The Run Command failed
error persists.
(x) Error: TeamsfxCLI.RunCommandFailed: Task 'Run Command' failed.
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 0% | [1/1] Run Command: npm run dev:teamsfx (✖) Failed.
(x) Error: TeamsfxCLI.RunCommandFailed: Task 'Run Command' failed.
And weirdly log file at /home/us-er/.fx/cli-log/local-preview/YYY-MM-DDT0HH_MM_SS_468Z/Run-Command.log
contain a single line:
npm run dev:teamsfx
Edit:
I've made minor changes to the code, you may have to force pull.
Good to know workaround works.
For the Run Command failed
issue, probably due to only listening on stdout (related source code). Created internal item to track the fix.
Describe the bug
When running
teamsfx preview --env local
I getError: TeamsfxCLI.RunCommandFailed: Task 'Run Command' failed.
To Reproduce Steps to reproduce the behavior:
teamsfx new
cd epitoma
teamsfx account show
ngrok http 3988
Edit
env/.env.local
to add the following lines:teamsfx validate --env local
teamsfx provision --env local
teamsfx deploy --env local
Finally
teamsfx preview --env local
Expected behavior Application preview happens without any hiccups.
CLI Information (please complete the following information):
Additional context