How to fix the build and deployment error in git hub for static web app

KARTHIK KRISHNAN 0 Reputation points
2025-11-19T00:07:58.78+00:00

Run Azure/static-web-apps-deploy@v1

with:

azure_static_web_apps_api_token: ***

repo_token: ***

action: upload

skip_app_build: true

app_location: ChargeUp

output_location: dist/ChargeUp/browser

/usr/bin/docker run --name c2d0e311d3a7a602b47eba56ff0928e094303_6f9beb --label 1c2d0e --workdir /github/workspace --rm -e "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN" -e "INPUT_REPO_TOKEN" -e "INPUT_ACTION" -e "INPUT_SKIP_APP_BUILD" -e "INPUT_APP_LOCATION" -e "INPUT_OUTPUT_LOCATION" -e "INPUT_API_LOCATION" -e "INPUT_API_BUILD_COMMAND" -e "INPUT_APP_ARTIFACT_LOCATION" -e "INPUT_APP_BUILD_COMMAND" -e "INPUT_ROUTES_LOCATION" -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_ACTOR_ID" -e "GITHUB_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_REPOSITORY_ID" -e "GITHUB_TRIGGERING_ACTOR" -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_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/ChargeupWeb/ChargeupWeb":"/github/workspace" 1c2d0e:311d3a7a602b47eba56ff0928e094303

DeploymentId: 7c5c817c-d663-49cf-ba23-5ddc219e2127

Try to validate location at: '/github/workspace/ChargeUp'.

App Directory Location: 'ChargeUp' was found.

Try to validate location at: '/github/workspace/swa-db-connections'.

Looking for event info

The content server has rejected the request with: BadRequest

Reason: No matching Static Web App was found or the api key was invalid.

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

0s

1s

0s

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2025-11-19T00:08:23.2533333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To fix the build and deployment error for your Azure Static Web App, you can follow these steps:

    1. Check API Token: Ensure that the azure_static_web_apps_api_token you are using is valid and has the necessary permissions. An invalid or expired token can lead to the "No matching Static Web App was found or the api key was invalid" error.
    2. Validate App Directory: Confirm that the app_location specified (in your case, ChargeUp) is correct and that the directory exists in your GitHub repository. The deployment process is looking for this directory at /github/workspace/ChargeUp.
    3. Check Output Location: Ensure that the output_location (in your case, dist/ChargeUp/browser) is correctly set and that the build process is producing the expected output in this directory.
    4. Review GitHub Actions Logs: Go to your GitHub repository, select Actions, and review the logs for the specific workflow run that failed. Look for any additional error messages that might provide more context on the failure.
    5. Configuration File: Check your staticwebapp.config.json file for any misconfigurations, especially regarding the api_location and app_location settings.
    6. Re-run the Workflow: After making any necessary changes, commit your updates and push them to your repository to trigger the GitHub Actions workflow again.

    If the problem persists, consider raising an issue on the Azure Static Web Apps GitHub repository for further assistance.


    References:

    0 comments No comments

  2. Praneeth Maddali 2,355 Reputation points Microsoft External Staff Moderator
    2025-11-19T00:25:42.08+00:00

    Hi @KARTHIK KRISHNAN

    Thanks for reaching us regarding the deployment error in git hub for static web app

    The error message

    “No matching Static Web App was found or the api key was invalid

    typically indicates that the deployment token in your GitHub secret doesn’t match what Azure expects. This can occur if the Static Web App was recreated, renamed, or if the token was changed.

    To quickly resolve the issue, follow these steps:

    1. Open the Azure Portal and navigate to your Static Web App’s Overview page.
    2. Select Manage deployment token and then Reset token. Be sure to copy the new token immediately, as it will only be displayed once.
    3. Go to your GitHub repository’s Settings, then Secrets and variables under Actions. Locate the secret beginning with AZURE_STATIC_WEB_APPS_API_TOKEN_ (with a random suffix), edit it, paste the new token without any extra spaces or line breaks, and save.
    4. Re-run the workflow or push a small change. The deployment should work right away.

    Your workflow paths are correct for an Angular app (ChargeUp > dist/ChargeUp/browser), and using skip_app_build: true is fine as long as the dist folder is created earlier in the process.

    If you still encounter issues after resetting the token, try disconnecting and reconnecting the repository in the Azure portal (Overview > Manage deployment token >Remove GitHub connection >re-connect). This will generate a new secret and update the workflow file.

    Reference :

    https://learn.microsoft.com/en-us/azure/static-web-apps/deployment-token-management

    https://learn.microsoft.com/en-us/azure/static-web-apps/overview

    https://learn.microsoft.com/en-us/azure/static-web-apps/build-configuration?tabs=identity&pivots=github-actions

    https://learn.microsoft.com/en-us/azure/static-web-apps/troubleshooting

    https://docs.github.com/en/actions/how-tos/deploy/deploy-to-third-party-platforms/azure-static-web-app

    Kindly let us know if the above helps or you need further assistance on this issue.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.