azure static web "Oryx built the app folder but was unable to determine the location of the app artifacts. Please specify the app artifact location"
Asked Answered
S

2

6

I have a simple index.html in github. I created a static web app in azure and pointed it to git hub. It ran some sort of build pipeline and my page was live without problem.

Now I added some more pages, but when I push to git, the static web app build fails with:

Oryx built the app folder but was unable to determine the location of the app artifacts. Please specify the app artifact location.

Many people have the same issue, and the general recommendation is to set api_location, but I cant find where this is specified.

I cant find any build scripts, and I certainly dont have enough knowledge to write one from scratch.

The build script presumably only needs to do a simple checkout of the git files.

UPDATE

Searching for a solution, I came across a yaml file hidden under .github.

It has the following:

      app_location: "/" # App source code path
      api_location: "" # Api source code path - optional
      output_location: "" # Built app content directory - optional

This doesn't really help, as its not obvious what an "app artifact" is, nor where it should go.

Any suggestions?

Sivie answered 19/5, 2022 at 17:5 Comment(0)
S
8

The solution was to find the hidden yaml build file created by Azure, and add this line:

     skip_app_build: true

The build file was in .github/workflows/ and was called something like azure-static-web-apps-happy-banana-0ed8b4dxx.yml

Not sure why this settings is not in there by default - most static web sites are just static sites. As far as I know, you can't have php or other server side code in static web apps.

Sivie answered 21/5, 2022 at 13:27 Comment(3)
Just want to add that I tried using this today in Bitbucket Cloud and it requires the property "skip_app_build" to be a string and not a boolean. skip_app_build: 'true'Semipalatinsk
That's interesting @RyanCannon I did not need single-quotes... (but otherwise the two answers by @JohnLittle and @Sneha helped me; I used skip_app_build: true (and skip_api_build: true)Faddish
Here exactly should be added?Heger
B
1

I faced the same issue while deploying a React SPA as a Static Web App. I use Nx as the build tool so I had to set is_static_export to true and define an output_location:

is_static_export: true
output_location: '/dist/apps/myapp/exported'

As mentioned here is_static_export is used when a custom build pipeline is used. The output_location is explicitly defined to avoid Oryx getting confused.

Biannulate answered 10/1 at 14:5 Comment(1)
I had to follow both answers, skip_app_build and output_locationKronfeld

© 2022 - 2024 — McMap. All rights reserved.