Sam Vanhoutte
Sam Vanhoutte

Reputation: 3451

Static azure web app deployment of Hugo site fails in github with 'unable to determine the location of the app artifacts'

I'm trying to set up a hugo static web app on Azure, and I followed (to get started) literally the following tutorial: https://learn.microsoft.com/en-us/azure/static-web-apps/publish-hugo . The only thing I did different was change the name of the github repo and the name of the website.

However, when my github workflow is triggered, I can see the following exception in the workflow logs:

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

For reference, this is the github workflow file:

name: Azure Static Web Apps CI/CD

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

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - 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_AGREEABLE_BEACH_0DCDA1B03 }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          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: "" # Built app content directory - optional
          ###### End of Repository/Build Configurations ######

  close_pull_request_job:
    if: github.event_name == 'pull_request' && github.event.action == 'closed'
    runs-on: ubuntu-latest
    name: Close Pull Request Job
    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_AGREEABLE_BEACH_0DCDA1B03 }}
          action: "close"

And this is the log file output:

App Directory Location: '/' was found.
No Api directory specified. Azure Functions will not be created.
Looking for event info
Starting to build app with Oryx
Azure Static Web Apps utilizes Oryx to build both static applications and Azure Functions. You can find more details on Oryx here: https://github.com/microsoft/Oryx
---Oryx build logs---


Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20220323.2, Commit: a7f6e2eb2eb42b5c2283d25131ef1f097480015e, ReleaseTagName: 20220323.2

Build Operation ID: |A8hf7rSNRrE=.c43f78be_
Repository Commit : ff7e914452669bb52cffa74[11](https://github.com/SamVanhoutte/solida/runs/6470725399?check_suite_focus=true#step:4:11)2225aa7b307480f

Detecting platforms...
Detected following platforms:
  hugo: 0.90.1


Source directory     : /github/workspace
Destination directory: /bin/staticsites/ss-oryx/app


Using Hugo version:
hugo v0.90.1-48907889+extended linux/amd64 BuildDate=2021-[12](https://github.com/SamVanhoutte/solida/runs/6470725399?check_suite_focus=true#step:4:12)-10T10:56:41Z VendorInfo=gohugoio

Start building sites … 
hugo v0.90.1-48907889+extended linux/amd64 BuildDate=[20](https://github.com/SamVanhoutte/solida/runs/6470725399?check_suite_focus=true#step:4:20)[21](https://github.com/SamVanhoutte/solida/runs/6470725399?check_suite_focus=true#step:4:21)-12-10T10:56:[41](https://github.com/SamVanhoutte/solida/runs/6470725399?check_suite_focus=true#step:4:41)Z VendorInfo=gohugoio

                   | EN  
-------------------+-----
  Pages            |  7  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     |  2  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  1  
  Cleaned          |  0  

Total in 110 ms
Preparing output...

Copying files to destination directory '/bin/staticsites/ss-oryx/app'...
Done in 0 sec(s).

Removing existing manifest file
Creating a manifest file...
Manifest file created.

Done in 0 sec(s).


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

For further information, please visit the Azure Static Web Apps documentation at https://learn.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

Upvotes: 0

Views: 1339

Answers (2)

Mehdi
Mehdi

Reputation: 56

For those who use custom build scripts, you should set is_static_export to true:

is_static_export: true

For more information see this.

Upvotes: 0

j.a.estevan
j.a.estevan

Reputation: 3097

Change

      output_location: "" # Built app content directory - optional

by

      output_location: "public" 

Upvotes: 2

Related Questions