Azure / Azure/static-web-apps-cli

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

Aperta
#937 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
668
Fork
156
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dai punti di ingresso `swa deploy` e `swa` e riproduci il problema su Windows con PowerShell 7 usando un `app/staticwebapp.config.json` contenente `{}`. Traccia come viene letto e convalidato quel file; il lavoro è completato quando sia la configurazione vuota sia la configurazione `navigationFallback` mostrata vengono distribuite senza un errore di convalida JSON.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
azure, typescript
Ambito
cli, cloud
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.