Reputation: 12441
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.
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?
Upvotes: 7
Views: 7797
Reputation: 1
"scripts": {
"start": "react-scripts start",
"build": "CI=false && react-scripts build", // Add CI=False here
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Upvotes: 0
Reputation: 56
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.
Upvotes: 1
Reputation: 12441
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.
Upvotes: 10