Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
330 stars 56 forks source link

App Directory Location: '/app' is invalid. Could not detect this directory. Please verify your workflow reflects your repository structure. #410

Open jennyxchengsea opened 3 years ago

jennyxchengsea commented 3 years ago

I've tried to deploy the static web app via github, and I received this error.

App Directory Location: '/app' is invalid. Could not detect this directory. Please verify your workflow reflects your repository structure.

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 believe it has something to do with setting on repositoryToken and appLocation

How do I find these info via my github repository?

riverar commented 3 years ago

Hi @jennyxchengsea, after binding your GitHub repository to Static Web Apps, you should have a GitHub Actions workflow defined at .github/workflows/xxxxx.yaml.

Within the file, app_location points to your web app sources live and api_location points to where your web app api sources live. If your app_location points to a folder with some static html/css, and no special build steps are needed, you can skip the build step completely (by adding skip_app_build: true right below that line).

More details can be found in the documentation.

JoCa96 commented 3 years ago

I had the same issue when using the Azure DevOps Task AzureStaticWebApp@0. You can fix the issue there by using the undocumented cwd (current working directory) input parameter:

- task: AzureStaticWebApp@0
     inputs:
       cwd: $(Pipeline.Workspace)/${{parameters.artifact}}
       app_location: ${{parameters.distDirectory}}
       azure_static_web_apps_api_token: ${{parameters.azureStaticWebAppsApiToken}}
svdHero commented 3 years ago

@JoCa96 How did you find out about the cwd input parameter? How likely is it to be removed in future versions?

anthonychu commented 3 years ago

cwd should appear in the Azure DevOps UX if you use it to edit your tasks.

We missed adding it to the docs. We'll work on that.