microsoft / Oryx

Build your repo automatically.
Other
768 stars 176 forks source link

Oryx fails to detect platforms in Hugo blog #752

Closed alexhudson closed 4 years ago

alexhudson commented 4 years ago

Bug Report

I created a new Hugo-based blog this morning, and am trying to deploy it via Azure Static Apps preview.

During the CI/CD, I get this response:

App Directory Location: '/' was found.
[WARNING] Api Directory Location: 'api' could not be found. Azure Functions will not be created.
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 will build app with the following custom override command: hugo
---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.20200719.1, Commit: 80603ef82312ab8b6d950149f332638c5707de74, ReleaseTagName: 20200719.1

Build Operation ID: |AzuAF2Uuhv8=.8a66635f_
Repository Commit : efa54c9c1e4179fd62231c47c8852989db398022

Detecting platforms...
Error: Oops... An unexpected error has occurred.

There seems to be an issue with the platform detection, but I don't seem to be able to enable Oryx debug mode to get a better backtrace, and there doesn't appear to be an obvious workaround. I'm not using Oryx to do the build - I have these steps setup:

      - name: Build
        run: hugo
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v0.0.1-preview
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
          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 you app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_build_command: hugo
          app_location: "/" # App source code path
          api_location: "api" # Api source code path - optional
          app_artifact_location: "public" # Built app content directory - optional
          ###### End of Repository/Build Configurations ######

... and the build process is working fine; I just need Oryx to do the upload step. Even overriding the app build command, it's still doing the platform detection and I get the same error.

kichalla commented 4 years ago

@alexhudson if possible could you please share your repro app or the repository where we can take a look at the code?

alexhudson commented 4 years ago

I can't share the blog unfortunately, but I've managed to create a minimal case. The problem appears to be the Hugo config.toml:

baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
theme = "ananke"

[params.plugins]
  # CSS Plugins
  [[params.plugins.css]]
  URL = "plugins/bootstrap/bootstrap.min.css"

[params]
home = "Home"

This content as config.toml appears to confuse the parser. If I reorder it so the [params] section appears first, it works! Hugo appears to accept it either way; I'm not necessarily claiming it's valid TOML at this point (I don't know), but this was an existing working Hugo build.

So I at least have a workaround now!

kichalla commented 4 years ago

@alexhudson Thanks for the details. We will try to see what can be done about it.

mehmetcankamar commented 4 years ago

I have also countered with this issue. I have an .net core api and vuejs static web project. I was trying to create flow to publish static project through github. Projects are in same repo. Checked every file in ui project but i did not find any problem. Then, I tried to remove api location from flow file, wow, it works like a charm.

Not working:

app_location: "ticketpulse-ui" 
api_location: "/"
app_artifact_location: "dist" 

Working:

app_location: "ticketpulse-ui" 
api_location: ""
app_artifact_location: "dist" 
qianz2 commented 4 years ago

We've updated the toml file parser so that your minimal case should be considered as a valid toml file now. The update is in the latest release. Thanks for reporting the issue. We'll close this.