OfficeDev / TeamsFx

Developer tools for building Teams apps
Other
427 stars 164 forks source link

[Bug] Preview version 17.7.0 Preview 1.0 Teamsapp dependency build error #8899

Closed wrharper-AASP closed 7 months ago

wrharper-AASP commented 11 months ago

It looks like you guys are in the process of creating an issue link system which is great, but everything is coming back null in the error currently.

[core] lock released on C:\Users\USERID\OneDrive\Desktop\Work\repos\PROJECTNAMEHERE
[core] success to acquire lock for task provisionResources on: C:\Users\USERID\OneDrive\Desktop\Work\repos\PROJECTNAMEHERE
Trying to resolve actions for lifecycle provision
Action aadApp/create found for lifecycle provision
Action teamsApp/create found for lifecycle provision
Action {"name":"Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__DOMAIN for local launch","uses":"script"} found for lifecycle provision
Action {"name":"Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__ENDPOINT for local launch","uses":"script"} found for lifecycle provision
Action {"name":"Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__INDEXPATH for local launch","uses":"script"} found for lifecycle provision
Action file/createOrUpdateJsonFile found for lifecycle provision
Action aadApp/update found for lifecycle provision
Action teamsApp/validateManifest found for lifecycle provision
Action teamsApp/zipAppPackage found for lifecycle provision
Action teamsApp/update found for lifecycle provision
Executing app registration and provision 

Lifecycle stage: provision(10 step(s) in total). The following actions will be executed: 
(1/10) Action aadApp/create: Create an Azure Active Directory app to authenticate users.
(2/10) Action teamsApp/create: create a Teams app.
(3/10) Action script(Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__DOMAIN for local launch)
(4/10) Action script(Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__ENDPOINT for local launch)
(5/10) Action script(Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__INDEXPATH for local launch)
(6/10) Action file/createOrUpdateJsonFile: Create or update appsettings to JSON file.
(7/10) Action aadApp/update: Apply Azure Active Directory app manifest to an existing app.
(8/10) Action teamsApp/validateManifest: validate a Teams app.
(9/10) Action teamsApp/zipAppPackage: build a Teams app package.
(10/10) Action teamsApp/update: update a Teams app.

Executing lifecycle provision
Trying to resolve actions for lifecycle provision
Action aadApp/create found for lifecycle provision
Action teamsApp/create found for lifecycle provision
Action {"name":"Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__DOMAIN for local launch","uses":"script"} found for lifecycle provision
Action {"name":"Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__ENDPOINT for local launch","uses":"script"} found for lifecycle provision
Action {"name":"Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__INDEXPATH for local launch","uses":"script"} found for lifecycle provision
Action file/createOrUpdateJsonFile found for lifecycle provision
Action aadApp/update found for lifecycle provision
Action teamsApp/validateManifest found for lifecycle provision
Action teamsApp/zipAppPackage found for lifecycle provision
Action teamsApp/update found for lifecycle provision
Executing action aadApp/create in lifecycle provision
Executing action aadApp/create
Environment variable AAD_APP_CLIENT_ID already exist, skipping new Azure Active Directory app creation step.
Environment variable SECRET_AAD_APP_CLIENT_SECRET already exist, skipping new Azure Active Directory app creation step.
Action aadApp/create executed successfully
Action aadApp/create in lifecycle provision succeeded with output {}
Executing action teamsApp/create in lifecycle provision
Action teamsApp/create in lifecycle provision succeeded with output {"TEAMS_APP_ID":"1c424f52-aad5-4fed-b22d-cf57335e5e1d","TEAMS_APP_TENANT_ID":"4f2ed9de-29e0-4814-b073-2bdf658144de"}
Executing action {"name":"Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__DOMAIN for local launch","uses":"script"} in lifecycle provision
Start to run command: "echo "::set-teamsfx-env PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__DOMAIN=localhost:44302"" on path: "C:\Users\USERID\OneDrive\Desktop\Work\repos\PROJECTNAMEHERE".
 [script action stdout] ::set-teamsfx-env PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__DOMAIN=localhost:44302

Action {"name":"Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__DOMAIN for local launch","uses":"script"} in lifecycle provision succeeded with output {"PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__DOMAIN":"localhost:44302"}
Executing action {"name":"Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__ENDPOINT for local launch","uses":"script"} in lifecycle provision
Start to run command: "echo "::set-teamsfx-env PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__ENDPOINT=https://localhost:44302"" on path: "C:\Users\USERID\OneDrive\Desktop\Work\repos\PROJECTNAMEHERE".
 [script action stdout] ::set-teamsfx-env PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__ENDPOINT=https://localhost:44302

Action {"name":"Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__ENDPOINT for local launch","uses":"script"} in lifecycle provision succeeded with output {"PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__ENDPOINT":"https://localhost:44302"}
Executing action {"name":"Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__INDEXPATH for local launch","uses":"script"} in lifecycle provision
Start to run command: "echo "::set-teamsfx-env PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__INDEXPATH=#"" on path: "C:\Users\USERID\OneDrive\Desktop\Work\repos\PROJECTNAMEHERE".
 [script action stdout] ::set-teamsfx-env PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__INDEXPATH=#

Action {"name":"Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__INDEXPATH for local launch","uses":"script"} in lifecycle provision succeeded with output {"PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__INDEXPATH":"#"}
Executing action file/createOrUpdateJsonFile in lifecycle provision
Unable to execute action file/createOrUpdateJsonFile. Error message: {}
Failed to Execute lifecycle provision due to failed action: file/createOrUpdateJsonFile. UnhandledError:An unexpected error has occurred while performing the file/createOrUpdateJsonFile task. The reason for this error is: {}. Welcome to report this issue by clicking on the provided "Issue Link", so that we can investigate and resolve the problem as soon as possible.. Env output: {"TEAMS_APP_ID":"1c424f52-aad5-4fed-b22d-cf57335e5e1d","TEAMS_APP_TENANT_ID":"4f2ed9de-29e0-4814-b073-2bdf658144de","PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__DOMAIN":"localhost:44302","PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__ENDPOINT":"https://localhost:44302","PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__INDEXPATH":"#"}
Execution summary:

Summary:
(×) Error: Lifecycle stage provision failed.
  (√) Done: aadApp/create was executed successfully.
  (√) Done: teamsApp/create was executed successfully.
    (√) Done: Teams app with id 1c424f52-aad5-4fed-b22d-cf57335e5e1d already exists, skipped creating a new Teams app.
  (√) Done: script(Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__DOMAIN for local launch) was executed successfully.
    (√) Done: Successfully executed command 'echo "::set-teamsfx-env PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__DOMAIN=localhost:44302"'
  (√) Done: script(Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__ENDPOINT for local launch) was executed successfully.
    (√) Done: Successfully executed command 'echo "::set-teamsfx-env PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__ENDPOINT=https://localhost:44302"'
  (√) Done: script(Set PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__INDEXPATH for local launch) was executed successfully.
    (√) Done: Successfully executed command 'echo "::set-teamsfx-env PROVISIONOUTPUT__AZUREWEBAPPTABOUTPUT__INDEXPATH=#"'
  (×) Error: file/createOrUpdateJsonFile failed.
    (×) Error: An unexpected error has occurred while performing the file/createOrUpdateJsonFile task. The reason for this error is: {}. Welcome to report this issue by clicking on the provided "Issue Link", so that we can investigate and resolve the problem as soon as possible.
  (!) Warning: aadApp/update was not executed.
  (!) Warning: teamsApp/validateManifest was not executed.
  (!) Warning: teamsApp/zipAppPackage was not executed.
  (!) Warning: teamsApp/update was not executed.

[core] lock released on C:\Users\USERID\OneDrive\Desktop\Work\repos\PROJECTNAMEHERE
{
  "errorType": "SystemError",
  "source": "file/createOrUpdateJsonFile",
  "name": "UnhandledError",
  "message": "An unexpected error has occurred while performing the file/createOrUpdateJsonFile task. The reason for this error is: {}. Welcome to report this issue by clicking on the provided \"Issue Link\", so that we can investigate and resolve the problem as soon as possible.",
  "stack": "UnhandledError: An unexpected error has occurred while performing the file/createOrUpdateJsonFile task. The reason for this error is: {}. Welcome to report this issue by clicking on the provided \"Issue Link\", so that we can investigate and resolve the problem as soon as possible.\n    at CreateOrUpdateJsonFileDriver.handler (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)\n    at async C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js\n    at async Object.wrapRun (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)\n    at async CreateOrUpdateJsonFileDriver.execute (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)\n    at async CreateOrUpdateJsonFileDriver.<anonymous> (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)\n    at async CreateOrUpdateJsonFileDriver.<anonymous> (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)\n    at async Lifecycle.executeImpl (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)\n    at async Lifecycle.execute (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)\n    at async Coordinator.provision (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)\n    at async Coordinator.<anonymous> (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)\n    at async FxCoreV3Implement.provisionResources (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)\n    at async FxCoreV3Implement.<anonymous> (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)\n    at async FxCoreV3Implement.<anonymous> (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)\n    at async FxCoreV3Implement.<anonymous> (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)\n    at async Object.envLoaderMWImpl (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)\n    at async FxCoreV3Implement.<anonymous> (C:\\snapshot\\TeamsFx\\packages\\server\\lib\\index.js)",
  "innerError": null,
  "userData": null,
  "timestamp": "2023-06-01T16:06:20.546Z",
  "displayMessage": "An unexpected error has occurred while performing the file/createOrUpdateJsonFile task. The reason for this error is: {}. Welcome to report this issue by clicking on the provided \"Issue Link\", so that we can investigate and resolve the problem as soon as possible.",
  "helpLink": null,
  "issueLink": null
}
ghost commented 11 months 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.

wrharper-AASP commented 11 months ago

image

therealjohn commented 11 months ago

@wrharper-AASP I can't reproduce this with VS 2022 17.7.0 P1 - are you using that version?

wrharper-AASP commented 11 months ago

Well, it worked at first and then just stopped and I can't find any reason as to why since I have changed nothing. Yes, I am using that version. This was upgraded from version 17.6.2

wrharper-AASP commented 11 months ago

I would say the biggest issue is the fact that it comes up with no actual error.

  "displayMessage": "An unexpected error has occurred while performing the file/createOrUpdateJsonFile task. The reason for this error is: {}. Welcome to report this issue by clicking on the provided \"Issue Link\", so that we can investigate and resolve the problem as soon as possible.",
  "helpLink": null,
  "issueLink": null
wrharper-AASP commented 11 months ago

the best lead I can think of is when MSGraph changed their requirements. This part in the new teamsapp.local.yml looks wrong:

  - uses: file/createOrUpdateJsonFile
    with:
      target: ./appsettings.Development.json
      appsettings:
        TeamsFx:
          Authentication:
            ClientId: ${{AAD_APP_CLIENT_ID}}
            ClientSecret: ${{SECRET_AAD_APP_CLIENT_SECRET}}
            OAuthAuthority: ${{AAD_APP_OAUTH_AUTHORITY}}

it is missing how you would handle the new InitiateLoginEndpoint in appsettings...

  "TeamsFx": {
    "Authentication": {
      "ClientId": "REMOVEDFORSECURITY",
      "ClientSecret": "REMOVEDFORSECURITY",
      "InitiateLoginEndpoint": "https://localhost:44302/auth-start.html", //New Line
      "OAuthAuthority": "https://login.microsoftonline.com/TENANTIDGOESHERE"
    }
wrharper-AASP commented 11 months ago

the initiateloginendpoint is also not setup in this part of teamsapp.local.yml:

    writeToEnvironmentFile: # Write the information of created resources into environment file for the specified environment variable(s).
      clientId: AAD_APP_CLIENT_ID
      clientSecret: SECRET_AAD_APP_CLIENT_SECRET # Environment variable that starts with `SECRET_` will be stored to the .env.{envName}.user environment file
      objectId: AAD_APP_OBJECT_ID
      tenantId: AAD_APP_TENANT_ID
      authority: AAD_APP_OAUTH_AUTHORITY
      authorityHost: AAD_APP_OAUTH_AUTHORITY_HOST

this will probably be an issue for the published version in yml & .env.dev files as well.

wrharper-AASP commented 11 months ago

I removed the initiateloginendpoint from appsettings as a test and the error did change to an issue with the next area(aadApp/update.)

This shows that it did fix that issue, but this appears to be a chain reaction of issues at this point.

  1. if you remove the new InitiateLoginEndpoint there will be consent check failures again.
  2. now there is problems with aadApp/update

Focus on InitiateLoginEndpoint and I believe you will find the root cause.

wrharper-AASP commented 11 months ago

see https://github.com/OfficeDev/TeamsFx/issues/8734 for more information on why this is required now.

summzhan commented 11 months ago

@blackchoey , could you please help take a look at why InitiateLoginEndpoint will cause consent check failures?

summzhan commented 11 months ago

see #8734 for more information on why this is required now.

@wrharper-AASP We cherished your feedbacks, if it's ok, we can have a call to discuss the issues in details. Feel free to book sometime talk with us.

blackchoey commented 11 months ago

Per #8734, the InitiateLoginEndpoint is needed in latest SDK so removing it will cause error because the app does not know which URL to open when it requires user login.

@wrharper-AASP can you describe your current situation? Are you just upgraded your project using VS 2022 17.7.0 P1 and met above error, or you already upgraded your project using an earlier VS version but the project suddenly stopped working with VS 2022 17.7.0 P1? Please try to add InitiateLoginEndpoint to file/createOrUpdateJsonFile to see whether it can fix the problem. The action aims to provide values for your appsettings.development.json so your app have required app settings to run locally:

  - uses: file/createOrUpdateJsonFile
    with:
      target: ./appsettings.Development.json
      appsettings:
        TeamsFx:
          Authentication:
            ClientId: ${{AAD_APP_CLIENT_ID}}
            ClientSecret: ${{SECRET_AAD_APP_CLIENT_SECRET}}
            OAuthAuthority: ${{AAD_APP_OAUTH_AUTHORITY}}
            InitiateLoginEndpoint: https://localhost:44302/auth-start.html

@swatDong please help take a look at below error. Seems if the json file contains extra property (InitiateLoginEndpoint here), the action will fail:

An unexpected error has occurred while performing the file/createOrUpdateJsonFile task. The reason for this error is: {}.
swatDong commented 11 months ago

Is there any comment (// json comment /* json comment */) in the targe JSON file? It appears file/createOrUpdateJsonFile cannot correctly handle JSON comment in 17.7.0 P1. For workaround, please:

cc @xiaolang124

AASPLLC commented 11 months ago

see #8734 for more information on why this is required now.

@wrharper-AASP We cherished your feedbacks, if it's ok, we can have a call to discuss the issues in details. Feel free to book sometime talk with us.

I would love to talk about this, but it looks like all your available times are at 1:30AM-2AM

summzhan commented 11 months ago

see #8734 for more information on why this is required now.

@wrharper-AASP We cherished your feedbacks, if it's ok, we can have a call to discuss the issues in details. Feel free to book sometime talk with us.

I would love to talk about this, but it looks like all your available times are at 1:30AM-2AM

Hi @AASPLLC , where are you located and what's your time zone? Could you send me email at zhany@microsoft.com so that easier for us to set up a call?

wrharper-AASP commented 7 months ago

I no longer use the preview version.