Azure / Azure/static-web-apps

Invalid staticwebapp.config.json causes deploy failure but logs don't indicate reason

Open
#845 1 comment 1 reaction 0 assignees View on GitHub
bug config triaged
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

If staticwebapp.config.json is invalid in some way and the deployment is done via a pipline (AzDo pipeline in this case but I presume the issue is the same in GitHub actions) the deploy will fail however the logs won't indicate what the issue is.

**To Reproduce**
Steps to reproduce the behavior:
Add an invalid staticwebapp.config.json such as (missing comma in this case):
```json
{
"navigationFallback": {
"rewrite": "/"
}
"mimeTypes": {
".json": "text/json",
".css": "text/css"
}
}

```

Attempt do deploy and the deploy will fail but not list the reason i.e.
```
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.20220401.1, Commit: afed4f696a08bfd4c8e4109704a082bf9fb20515, ReleaseTagName: 20220401.1

Build Operation ID: |WUcs22qhWxE=.c7347155_

Detecting platforms...
Could not detect any platform in the source directory.
Error: Could not detect the language from repo.

---End of Oryx build logs---
Oryx was unable to determine the build steps. Continuing assuming the assets in this folder are already built. If this is an unexpected behavior please contact support.
Finished building app with Oryx
An unknown exception has occurred

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
##[error]Error: The process '/usr/bin/bash' failed with exit code 1
```

**Expected behavior**
Logs should indicate staticwebapp.config.json is invalid

Contributor guide

No contributing guide indexed for this repository

Research direction

No repository files, tests, or entry points are identified. Start by reproducing the deployment with the invalid staticwebapp.config.json through an Azure pipeline, then trace where configuration validation and deployment errors are reported; done means the logs identify the invalid configuration and its parsing problem.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.