Azure Static Web Apps: "No matching static site found" error in Close Pull Request job

Discussão em 'Angular' iniciado por Tom S, Abril 7, 2025.

  1. Tom S

    Tom S Guest

    I have an Angular app that I want to deploy with Azure Static Web Apps. I have followed the Quickstart: Build your first static web app guide that sets up a Static Web App via the Azure Portal.

    I then get an autogenerated Github Actions workflow that builds and deploys the app to Azure Static Web apps. I have modified the Workflow to use yarn instead of npm, as my project uses yarn.

    Here is my workflow file:

    name: Azure Static Web Apps CI/CD

    on:
    push:
    branches:
    - master
    pull_request:
    types: [opened, synchronize, reopened, closed]
    branches:
    - master

    permissions:
    contents: read
    id-token: write
    issues: write
    pull-requests: write

    jobs:
    build_and_deploy:
    if:
    github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy
    steps:
    - uses: actions/checkout@v4
    with:
    submodules: true
    lfs: false
    - name: Get Yarn Cache
    uses: actions/setup-node@v4
    with:
    cache: 'yarn'
    node-version-file: '.nvmrc'
    - name: Install OIDC Client from Core Package
    run: yarn add @actions/core@1.6.0 @actions/http-client
    - name: Get Id Token
    uses: actions/github-script@v6
    id: idtoken
    with:
    script: |
    const core = require('@actions/core')
    return await core.getIDToken()
    result-encoding: string
    - name: Build And Deploy
    id: builddeploy
    uses: Azure/static-web-apps-deploy@v1
    with:
    azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_xxx }}
    repo_token: ${{ secrets.GITHUB_TOKEN }}
    action: 'upload'
    ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
    # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
    app_location: '/' # App source code path
    api_location: '' # Api source code path - optional
    output_location: '<my-output-location>' # Built app content directory - optional
    github_id_token: ${{ steps.idtoken.outputs.result }}
    skip_api_build: true # Set the value to true to skip building the API functions.
    ###### End of Repository/Build Configurations ######

    close_pull_request:
    if: github.event_name == 'pull_request' && github.event.action == 'closed'
    runs-on: ubuntu-latest
    name: Close Pull Request
    steps:
    - name: Close Pull Request
    id: closepullrequest
    uses: Azure/static-web-apps-deploy@v1
    with:
    azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_xxx }}
    action: 'close'


    The Close Pull Request job fails with the following error when trying to delete the environment preview after merging a pull request:


    Reason: No matching static site found.
    ​

    Output from Close Pull Request:

    ##[group]Run Azure/static-web-apps-deploy@v1
    with:
    app_location: /
    azure_static_web_apps_api_token: ***
    action: close
    ##[endgroup]
    ##[command]/usr/bin/docker run --name <docker-container-id> --label <docker-label> --workdir /github/workspace --rm -e "INPUT_APP_LOCATION" -e "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN" -e "INPUT_ACTION" -e "INPUT_API_BUILD_COMMAND" -e "INPUT_API_LOCATION" -e "INPUT_APP_ARTIFACT_LOCATION" -e "INPUT_OUTPUT_LOCATION" -e "INPUT_APP_BUILD_COMMAND" -e "INPUT_REPO_TOKEN" -e "INPUT_ROUTES_LOCATION" -e "INPUT_SKIP_APP_BUILD" -e "INPUT_CONFIG_FILE_LOCATION" -e "INPUT_SKIP_API_BUILD" -e "INPUT_PRODUCTION_BRANCH" -e "INPUT_DEPLOYMENT_ENVIRONMENT" -e "INPUT_IS_STATIC_EXPORT" -e "INPUT_DATA_API_LOCATION" -e "INPUT_GITHUB_ID_TOKEN" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_ID_TOKEN_REQUEST_URL" -e "ACTIONS_ID_TOKEN_REQUEST_TOKEN" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/<repository>/<repository>":"/github/workspace" <docker-image-id>
    DeploymentId: <deployment-id>

    Looking for event info
    The content server has rejected the request with: BadRequest
    Reason: No matching static site found.

    For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/
    If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/
    Exiting


    I have tried regenerating the Azure Static Web Apps API token and updating it in GitHub, but the issue persists.

    Question: How can I resolve the "No matching static site found" error in the Close Pull Request job? Is there something wrong with my workflow configuration?

    Continue reading...

Compartilhe esta Página