Azure / Azure/static-web-apps-cli

The following error was encountered: Unexpected token '', "{ "na"... is not valid JSON

Open
#937 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
668
Forks
156
PR merge metrics
No merged PRs in 30d

Description

SWA Version: 2.0.4

**Describe the bug**
When I run _swa deploy_ or _swa_ I get a JSON validation error, even my JSON's config files for the staticwebapp-config.json are all valid json.
With this state I can not deploy a SWA with a config.

**To Reproduce**
1. Place a json with the name "staticwebapp.config.json" in our "app" folder with the content `{}`
2. Run `swa deploy`

The following error occurs on my end:

_WARNING: Failed to read staticwebapp.config.json configuration from:
C:\folder1\folder2\folder3\client\staticwebapp.config.json_

_✖ The following error was encountered: Unexpected token '', "{}" is not valid JSON
Please fix the above error and try again to load and use the configuration.
Read more: https://aka.ms/swa/config-schema_

At this state the _staticwebapp.config.json_ only contains `{}`
But I tried configurations like the this one, and they not working too.

```
{
"navigationFallback": {
"rewrite": "/index.html"
}
}
```

**Error Message**:

_✖ The following error was encountered: Unexpected token '', "{
"na"... is not valid JSON_

**Expected behavior**
Deployment Working

**Desktop (please complete the following information):**

- OS: Windows
- Version PS7

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.