Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] Failed to deploy app when app name too long or different app name has same long prefix #4653

Open
rujche opened this issue Dec 26, 2024 · 0 comments

Comments

@rujche
Copy link
Member

rujche commented Dec 26, 2024

Link to sample project: https://github.com/microsoft/SJAD

Reproduce step:

  1. Run azd init, then manually change the app name in azure.yaml. (It can be achieved by another way: Rename the folder name then run azd init)
  2. Run azd up

1. Problem 1: long name

1.1. Example azure.yaml:

# yaml-language-server: $schema=https://raw.githubusercontent.com/azure-javaee/azure-dev/feature/sjad/schemas/alpha/azure.yaml.json

name: sjad
metadata:
    template: [email protected]
services:
    long-long-long-long-long-long-long-long-long-common-prefix-api:
        parentPath: C:\Users\rujche\Work\git-workspace\main\SJAD
        project: api
        host: containerapp
        language: java
        docker:
            path: Dockerfile
    long-long-long-long-long-long-long-long-long-common-prefix-email-service:
        parentPath: C:\Users\rujche\Work\git-workspace\main\SJAD
        project: email-service
        host: containerapp
        language: java
        docker:
            path: Dockerfile
    long-long-long-long-long-long-long-long-long-common-prefix-web:
        parentPath: C:\Users\rujche\Work\git-workspace\main\SJAD
        project: web
        host: containerapp
        language: java
        docker:
            path: Dockerfile
hooks:
    prepackage:
        windows:
            shell: pwsh
            run: .\mvnw.cmd clean package -DskipTests
        posix:
            shell: sh
            run: ./mvnw clean package -DskipTests
resources:
    long-long-long-long-long-long-long-long-long-common-prefix-api:
        type: host.containerapp
        uses:
            - mongo
            - servicebus
        port: 3100
    long-long-long-long-long-long-long-long-long-common-prefix-email-service:
        type: host.containerapp
        uses:
            - servicebus
        port: 8081
    long-long-long-long-long-long-long-long-long-common-prefix-web:
        type: host.containerapp
        uses:
            - long-long-long-long-long-long-long-long-long-common-prefix-api
            - long-long-long-long-long-long-long-long-long-common-prefix-email-service
        port: 8080
    mongo:
        type: db.mongo
        databaseName: todo
    servicebus:
        type: messaging.servicebus
        authType: userAssignedManagedIdentity
        isJms: true

1.2. Error message:

ERROR: error executing step command 'provision': deployment failed: error deploying infrastructure: deploying to subscription:

Deployment Error Details:
InvalidDeployment: The provided deployment name 'longLongLongLongLongLongLongLongLongCommonPrefixEmailServiceidentity' has a length of '68' which exceeds the maximum length of '64'. Please see https://aka.ms/arm-deploy for usage details.
InvalidDeployment: The provided deployment name 'longLongLongLongLongLongLongLongLongCommonPrefixEmailService-fetch-image' has a length of '72' which exceeds the maximum length of '64'. Please see https://aka.ms/arm-deploy for usage details.

TraceID: aa4f08e646a8222935cdbdbb2dc9bab8

2. Problem 2: multiple app with same long name prefix

2.1. Example azure.yaml:

# yaml-language-server: $schema=https://raw.githubusercontent.com/azure-javaee/azure-dev/feature/sjad/schemas/alpha/azure.yaml.json

name: sjad
metadata:
    template: [email protected]
services:
    long-long-long-long-long-long--common-prefix-api:
        parentPath: C:\Users\rujche\Work\git-workspace\main\SJAD
        project: api
        host: containerapp
        language: java
        docker:
            path: Dockerfile
    long-long-long-long-long-long-common-prefix-email-service:
        parentPath: C:\Users\rujche\Work\git-workspace\main\SJAD
        project: email-service
        host: containerapp
        language: java
        docker:
            path: Dockerfile
    long-long-long-long-long-long-common-prefix-web:
        parentPath: C:\Users\rujche\Work\git-workspace\main\SJAD
        project: web
        host: containerapp
        language: java
        docker:
            path: Dockerfile
hooks:
    prepackage:
        windows:
            shell: pwsh
            run: .\mvnw.cmd clean package -DskipTests
        posix:
            shell: sh
            run: ./mvnw clean package -DskipTests
resources:
    long-long-long-long-long-long--common-prefix-api:
        type: host.containerapp
        uses:
            - mongo
            - servicebus
        port: 3100
    long-long-long-long-long-long-common-prefix-email-service:
        type: host.containerapp
        uses:
            - servicebus
        port: 8081
    long-long-long-long-long-long-common-prefix-web:
        type: host.containerapp
        uses:
            - long-long-long-long-long-long--common-prefix-api
            - long-long-long-long-long-long-common-prefix-email-service
        port: 8080
    mongo:
        type: db.mongo
        databaseName: todo
    servicebus:
        type: messaging.servicebus
        authType: userAssignedManagedIdentity
        isJms: true

2.2. Error message:

Creating/Updating resources
  You can view detailed progress in the Azure Portal:
  https://portal.azure.com/#view/HubsExtension/DeploymentDetailsBlade/~/overview/id/%2Fsubscriptions%2F50328023-df85-46b6-96f5-c4566d7b063c%2Fproviders%2FMicrosoft.Resources%2Fdeployments%2Frujche-azd-env-241226-03-1735195829

  (✓) Done: Resource group: rg-rujche-azd-env-241226-03 (5.657s)
  (✓) Done: Log Analytics workspace: log-wlnou27362ogq (20.044s)
  (✓) Done: Application Insights: appi-wlnou27362ogq (4.693s)
  (✓) Done: Container Registry: crwlnou27362ogq (24.405s)
  (✓) Done: Key Vault: kv-wlnou27362ogq (22.937s)
  (✓) Done: Portal dashboard: dash-wlnou27362ogq (2.728s)
  (✓) Done: Service Bus Namespace: sb-wlnou27362ogq (1m9.293s)
  (✓) Done: Container Apps Environment: cae-wlnou27362ogq (38.582s)
  (✓) Done: Container App: long-long-long-long-long-long (23.234s)
  (✓) Done: Azure Cosmos DB: cosmos-wlnou27362ogq (2m12.844s)

Deploying services (azd deploy)

Deploying service long-long-long-long-long-long--common-prefix-api
  (x) Failed: Deploying service long-long-long-long-long-long--common-prefix-api

ERROR: error executing step command 'deploy --all': getting target resource: resource not found: unable to find a resource tagged with 'azd-service-name: long-long-long-long-long-long--common-prefix-api'. Ensure the service resource is correctly tagged in your infrastructure configuration, and rerun provision

Process finished with the exit code 1

2.3. The deployment details page shows it completed:

Image

2.4. In portal, expected 3 Container App, but only one Container App created:

Image

2.5. Actual tab in the Container App

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant