UnhandledError:无法重新定义属性:堆栈

问题描述 投票:0回答:1

我在通过工具包部署应用程序时遇到问题,出现错误 -> 无法重新定义属性:堆栈

堆栈:UnhandledError:无法重新定义属性:getError处的堆栈 (:14:5819447) 在 Object.wrapRun (:14:5819625) 在 processTicksAndRejections (节点::95:5)在 ArmDeployDriver.execute (:14:5553122) 在 Lifecycle.executeImpl (:14:5427203) 在 Lifecycle.execute (:14:5424360) 在 Coordinator.provision (:14:5470516)在协调员处。 (:14:6119329)在FxCore.provisionResources(:14:6047609)在FxCore.exports.EnvWriterMW(:14:5958667)在FxCore.exports.ContextInjectorMW (:14:6123081)在 FxCore.exports.ConcurrentLockerMW (:14:6122032) 在 FxCore 的 envLoaderMWImpl (:14:5958547)。 (:14:5957475) 在 FxCore.exports.ProjectMigratorMWV3 (:14:6153660)在 FxCore.exports.ErrorHandlerMW(:14:6123578) 在 FxCore。 (:14:6119329)

azure.二头肌:

    @maxLength(20)
    @minLength(4)
    param resourceBaseName string
    param storageSku string
    
    @description('Required when create Azure Bot service')
    param botAadAppClientId string
    
    @secure()
    @description('Required by Bot Framework package in your bot project')
    param botAadAppClientSecret string
    
    param webAppSKU string
    
    @maxLength(42)
    param botDisplayName string
    
    param serverfarmsName string = resourceBaseName
    param webAppName string = resourceBaseName
    
    param storageName string = resourceBaseName
    param location string = resourceGroup().location
    
    param microsoftAppTenantId string
    param tabDomain string
    
    // Azure Storage that hosts your static web site
    resource storage 'Microsoft.Storage/storageAccounts@2021-06-01' = {
      kind: 'StorageV2'
      location: location
      name: storageName
      properties: {
        supportsHttpsTrafficOnly: true
      }
      sku: {
        name: storageSku
      }
    }
    
    // Compute resources for your Web App
    resource serverfarm 'Microsoft.Web/serverfarms@2021-02-01' = {
      kind: 'app'
      location: location
      name: serverfarmsName
      sku: {
        name: webAppSKU
      }
    }
    
    // Web App that hosts your bot
    resource webApp 'Microsoft.Web/sites@2021-02-01' = {
      kind: 'app'
      location: location
      name: webAppName
      properties: {
        serverFarmId: serverfarm.id
        httpsOnly: true
        siteConfig: {
          alwaysOn: false
          appSettings: [
            {
              name: 'WEBSITE_RUN_FROM_PACKAGE'
              value: '1' // Run Azure APP Service from a package file
            }
            {
              name: 'WEBSITE_NODE_DEFAULT_VERSION'
              value: '~18' // Set NodeJS version to 18.x for your site
            }
            {
              name: 'RUNNING_ON_AZURE'
              value: '1'
            }
            {
              name: 'BOT_ID'
              value: botAadAppClientId
            }
            {
              name: 'BOT_PASSWORD'
              value: botAadAppClientSecret
            }
          ]
          ftpsState: 'FtpsOnly'
        }
      }
    }
    
    // Register your web service as a bot with the Bot Framework
    module azureBotRegistration './botRegistration/azurebot.bicep' = {
      name: 'Azure-Bot-registration'
      params: {
        resourceBaseName: resourceBaseName
        botAadAppClientId: botAadAppClientId
        botAppDomain: webApp.properties.defaultHostName
        botDisplayName: botDisplayName
        microsoftAppTenantId: microsoftAppTenantId
        botAadAppClientSecret: botAadAppClientSecret
        tabDomain: tabDomain
      }
    }
    
    var siteDomain = replace(replace(storage.properties.primaryEndpoints.web, 'https://', ''), '/', '')
    
    // The output will be persisted in .env.{envName}. Visit https://aka.ms/teamsfx-actions/arm-deploy for more details.
    output TAB_AZURE_STORAGE_RESOURCE_ID string = storage.id // used in deploy stage
    output TAB_DOMAIN string = siteDomain
    output TAB_ENDPOINT string = 'https://${siteDomain}'
    output BOT_AZURE_APP_SERVICE_RESOURCE_ID string = webApp.id
    output BOT_DOMAIN string = webApp.properties.defaultHostName

azurebot.bicep:

    @maxLength(20)
    @minLength(4)
    @description('Used to generate names for all resources in this file')
    param resourceBaseName string
    
    @maxLength(42)
    param botDisplayName string
    
    param botServiceName string = resourceBaseName
    param botServiceSku string = 'F0'
    param botAadAppClientId string
    param botAppDomain string
    param microsoftAppTenantId string
    param tabDomain string
    
    @secure()
    @description('Required by Bot Framework package in your bot project')
    param botAadAppClientSecret string
    
    // Register your web service as a bot with the Bot Framework
    resource botService 'Microsoft.BotService/botServices@2021-03-01' = {
      kind: 'azurebot'
      location: 'global'
      name: botServiceName
      properties: {
        displayName: botDisplayName
        endpoint: 'https://${botAppDomain}/api/messages'
        msaAppId: botAadAppClientId
      }
      sku: {
        name: botServiceSku
      }
    }
    
    // Connect the bot service to Microsoft Teams
    resource botServiceMsTeamsChannel 'Microsoft.BotService/botServices/channels@2021-03-01' = {
      parent: botService
      location: 'global'
      name: 'MsTeamsChannel'
      properties: {
        channelName: 'MsTeamsChannel'
      }
    }
    
    resource botServiceConnection 'Microsoft.BotService/botServices/connections@2021-03-01' = {
      parent: botService
      name: 'conntectorGraph'
      location: 'global'
      properties: {
        serviceProviderDisplayName: 'Azure Active Directory v2'
        serviceProviderId: '30dd229c-58e3-4a48-bdfd-91ec48eb906c'
        scopes: 'User.Read'
        parameters: [
          {
            key: 'clientId'
            value: botAadAppClientId
          }
          {
            key: 'clientSecret'
            value: botAadAppClientSecret
          }
          {
            key: 'tenantID'
            value: microsoftAppTenantId
          }
          {
            key: 'tokenExchangeUrl'
            value: 'api://${tabDomain}/botid-${botAadAppClientId}'
          }
        ]
      }
    }
    
    output CONNECTION_NAME string = botServiceConnection.name

azure.parameters.json:

    {
        "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
        "contentVersion": "1.0.0.0",
        "parameters": {
            "resourceBaseName": {
                "value": "tab${{RESOURCE_SUFFIX}}"
            },
            "storageSku": {
                "value": "Standard_LRS"
            },
            "botAadAppClientId": {
                "value": "${{BOT_ID}}"
            },
            "botAadAppClientSecret": {
                "value": "${{SECRET_BOT_PASSWORD}}"
            },
            "webAppSKU": {
                "value": "F1"
            },
            "botDisplayName": {
                "value": "BOT"
            },
            "microsoftAppTenantId": {
                "value": "${{AAD_APP_TENANT_ID}}"
            },
            "tabDomain": {
                "value": "${{TAB_DOMAIN}}"
            },
            "botAppDomain": {
                "value": "${{BOT_DOMAIN}}"
            }
        }
    }

teamsapp.local.yml:

    version: v1.2
    
    additionalMetadata:
      sampleTag: TeamsFx:msg-ext-with-tab
    
    environmentFolderPath: ./env
    
    provision:
      - uses: teamsApp/create
        with:
          name: MS_TEAMS_TAB_MSGEXT_local
        writeToEnvironmentFile:
          teamsAppId: TEAMS_APP_ID
      - uses: aadApp/create
        with:
          name: MS_TEAMS_TAB_MSGEXT_local
          generateClientSecret: true
          signInAudience: 'AzureADMyOrg'
        writeToEnvironmentFile:
          clientId: AAD_APP_CLIENT_ID
          clientSecret: SECRET_AAD_APP_CLIENT_SECRET
          objectId: AAD_APP_OBJECT_ID
          tenantId: AAD_APP_TENANT_ID
          authority: AAD_APP_OAUTH_AUTHORITY
          authorityHost: AAD_APP_OAUTH_AUTHORITY_HOST
      - uses: aadApp/update
        with:
          manifestPath: './aad.manifest.json'
          outputFilePath: ./build/aad.manifest.${{TEAMSFX_ENV}}.json
      - uses: botAadApp/create
        with:
          name: BOT-${{TEAMSFX_ENV}}
        writeToEnvironmentFile:
          botId: BOT_ID
          botPassword: SECRET_BOT_PASSWORD
      - uses: arm/deploy
        with:
          subscriptionId: ${{AZURE_SUBSCRIPTION_ID}}
          resourceGroupName: ${{AZURE_RESOURCE_GROUP_NAME}}
          templates:
            - path: ./infra/azure.bicep
              parameters: ./infra/azure.parameters.json
              deploymentName: Create-resources-for-tab
          bicepCliVersion: v0.9.1
      - uses: script
        with:
          run: echo "::set-teamsfx-env TAB_DOMAIN=localhost:53000";
            echo "::set-teamsfx-env TAB_ENDPOINT=https://localhost:53000";
      - uses: teamsApp/validateManifest
        with:
          manifestPath: ./appPackage/manifest.json
      - uses: teamsApp/zipAppPackage
        with:
          manifestPath: ./appPackage/manifest.json
          outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
          outputJsonPath: ./appPackage/build/manifest.${{TEAMSFX_ENV}}.json
      - uses: teamsApp/validateAppPackage
        with:
          appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
      - uses: teamsApp/update
        with:
          appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
    deploy:
      - uses: devTool/install
        with:
          devCert:
            trust: true
        writeToEnvironmentFile:
          sslCertFile: SSL_CRT_FILE
          sslKeyFile: SSL_KEY_FILE
      - uses: file/createOrUpdateEnvironmentFile
        with:
          target: ./tab/.localConfigs
          envs:
            BROWSER: none
            HTTPS: true
            PORT: 53000
            SSL_CRT_FILE: ${{SSL_CRT_FILE}}
            SSL_KEY_FILE: ${{SSL_KEY_FILE}}
            REACT_APP_CLIENT_ID: ${{AAD_APP_CLIENT_ID}}
            REACT_APP_TENANT_ID: ${{AAD_APP_TENANT_ID}}
            REACT_APP_TAB_ENDPOINT: ${{TAB_ENDPOINT}}
            REACT_APP_START_LOGIN_PAGE_URL: ${{TAB_ENDPOINT}}/auth-start.html
      - uses: file/createOrUpdateEnvironmentFile
        with:
          target: ./bot/.localConfigs
          envs:
            BOT_ID: ${{BOT_ID}}
            BOT_PASSWORD: ${{SECRET_BOT_PASSWORD}}
    projectId: xxxxxxxxxxxxxxxxxxxx

如何解决?我做错了什么?

azure arm microsoft-teams teams-toolkit
1个回答
0
投票

这是 Teams Toolkit 的内部错误,已在预发布版本中修复。

您可以尝试在 VSCode 扩展中Switch to the pre-release version。 或者由于此错误是由azure部署错误触发的(预期向用户显示部署错误,但被内部错误阻止),您可以尝试在资源组中查找错误部署错误。 参考这个。如果解决了部署错误,则不会触发该错误。

© www.soinside.com 2019 - 2024. All rights reserved.