Azure / Azure/static-web-apps-cli

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

Offen
#937 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
668
Forks
156
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit den Einstiegspunkten `swa deploy` und `swa` und reproduziere den Fehler unter Windows mit PowerShell 7 anhand einer `app/staticwebapp.config.json`, die `{}` enthält. Verfolge, wie diese Datei gelesen und validiert wird; abgeschlossen ist die Untersuchung, wenn sowohl die leere Konfiguration als auch die gezeigte `navigationFallback`-Konfiguration ohne einen JSON-Validierungsfehler deployt werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
azure, typescript
Bereich
cli, cloud
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.