Failed to load staticwebapp.config.json schema on start
I'm using the latest version 1.1.4
Are you accessing the CLI from the default port :4280 ?
- [ ] No, I am using a different port number (
--port) and accessing the CLI from that port - [X] Yes, I am accessing the CLI from port
:4280
Describe the bug
When starting an app with swa start I get WARNING: Failed to load staticwebapp.config.json schema. Continuing without validation!.
Even if it's just a warning and is referring to the schema file (not the config itself) staticwebapp.config.json doesn't work as expected. e.g. none of the routes declared is working.
To Reproduce Steps to reproduce the behavior:
- Go to any swa app
- Type in command 'swa start'
- See warning in console
- Check in browser any routes declared -> won't work.
Expected behavior
staticwebapp.config.json to work. Routes and any other settings declared to work.
Desktop (please complete the following information):
- OS: Windows
- Version: 11
Additional context After investigating this issue i have discovered that the URL used to load the config schema is hardcoded: https://github.com/Azure/static-web-apps-cli/blob/affefb24872286a542fe7bbd54340648ec3294d0/src/core/utils/user-config.ts#L168C13-L168C13 . At this moment, the website https://www.schemastore.org/ which is hosting the schema file, is down (error 503). Allowing loading the schema file only from a single website has created a single point of failure which we are experiencing right now.
staticwebapp.config.json has a property $schema, but as you can see the value is not used for actually loading the schema.
My suggestion is to allow the user to provide a value for $schema (in order to no longer depend on https://www.schemastore.org/ ).
Thank you.
Edit: there's currently an issue on Schemastore repository: https://github.com/SchemaStore/schemastore/issues/3303
I'm also seeing this warning, but routes are loading okay. I am using a customised config file swa-cli-config.json
My redirect from /login causes an error and the swa auth emulator does not seem to be protecting/allowing routes correctly. Trying to determine if related to above issue or not...
I have this issue also. It fails silently and won't load my settings. I use the config to set CORS, so my deployment is not accessible at all from my app. I cannot deploy anymore until I have a solution for this. I'm completely blocked.
Please, do you have a solution ?
I'm also running into this issue. Just had a new deployment, and users are redirected to 404 page if they try to access links directly or refresh the page.
Seeing the same problem. This does also affect the swa deploy command leading to a not working SWA
Temporary solution (what I did):
- Go to
%userprofile%\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\dist\core\utils(for Windows). - Open
user-config.js. - Search for
https://json.schemastore.org/staticwebapp.config.json. - Upload
staticwebapp.config.jsonto blob storage (for example) or use my file:https://stcuberdonintegration.blob.core.windows.net/assets/staticwebapp.config.json(Will be removed in 24H) - Replace
https://json.schemastore.org/staticwebapp.config.jsonwith your remote path.
Temporary solution (what I did):
- Go to
%userprofile%\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\dist\core\utils(for Windows).- Open
user-config.js.- Search for
https://json.schemastore.org/staticwebapp.config.json.- Upload
staticwebapp.config.jsonto blob storage (for example) or use my file:https://stcuberdonintegration.blob.core.windows.net/assets/staticwebapp.config.json(Will be removed in 24H)- Replace
https://json.schemastore.org/staticwebapp.config.jsonwith your remote path.
Confirm this fix by @aresofficial for the issue I observed...
I'm also seeing this warning, but routes are loading okay. I am using a customised config file swa-cli-config.json
My redirect from /login causes an error and the swa auth emulator does not seem to be protecting/allowing routes correctly. Trying to determine if related to above issue or not...
I can confirm that issue as well on 1.1.4. Also, the fix posted by @aresofficial is working for me.
That's really strange, how Azure position Static Web Apps as production-ready service, where your app can be totally inaccessible because of downtime on 3rd party service.
Moreover, not a single failure was seen, swa deploy will silently deploy your app and destroy all routes. That's "amazing"
As we are on linux when deploying, sadly the workaround does not work. One approach could be to setup a webserver which serves the schema. One could then point the building/deploying machine for the SWA to this server via a hosts entry :thinking:
It seems to be fixed.
Yes and no... someone threw more hardware on the problem so it works for now but the problem persists. One still depends on the availability of https://www.schemastore.org/. Not quite what i would call "fixed" :)
There was some problem in https://json.schemastore.org so that swa-cli got Error 500 Timeout. I have validate that it works well now, so I will close the issue. Feel free to repoen it if the error occurs again.
Really? Is it fixed so that when the schemastore isn't available it at least throws some kind of error and does not deploy a not working swa?.. I think it is not fixed.
I agree with @avalor1 . We should not depend on a third-party service which can become unavailable without notice.
Edit: My understanding is that the purpose of https://json.schemastore.org/ is to be used by various IDEs and VSCode extensions and SWA-CLI is using it for essential functionalities (build and deploy); even then it just logs a warning if it's unavailable. At the very least, on deployment it should throw an error when the service is unavailable. This way we'll avoid having broken SWAs in production. (and again wait for the service to become available 🙃)
The issue is not fixed, Static Web Apps CLI is still unstable. It's only a matter of time before problem recurs (e.g. because of outage on schemastore)
Deployment should at least not silently destroy routes, otherwise Static Web Apps can't be production-ready (as now). @cjk7989 can you please escalate this issue?
As others mentioned, this is still not fixed.
Hi all, we have published [email protected], which will throw an error if staticwebapp.config.json schema is failed to be download. And we plan to design a fallback method to completely fix the issue in the next version. Thanks very much for your feedback and suggestions.
I think validating the schema should be optional, either by not throwing an error or skipping it all together via a flag.
Also the current log message ("Continuing without validation") implies that the validation is optional right now, which is not the case since it breaks the build.
Either way, the domain https://json.schemastore.org/ is currently not listed in the troubleshooting section as domains that should be added to your firewall.
The current error is still "Continuing without validation". That will confuse users since it's aborting execution.
I see this issue in 1.1.6. Emulator does not work without internet. Fails to start.
[swa] ✖ Failed to load staticwebapp.config.json schema. Continuing without validation!
[swa] node ".pnpm/@[email protected]/node_modules/@azure/static-web-apps-cli/dist/msha/server.js" exited with code 0
Good morning. Can't locally start my Azure static web app because ....
network timeout at: https://json.schemastore.org/staticwebapp.config.json
The schema store is just sending 429 and 503s
I agree that this is a weird network dependency on what should should be "Airplane mode" type local dev work.