swa deploy: App without swa config file declaring platform api runtime aborts and fails without printing error info
See original GitHub issueBefore filing this issue, please ensure you’re using the latest CLI by running swa --version
and comparing to the latest version on npm.
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 - Yes, I am accessing the CLI from port
:4280
Make sure you are accessing the URL printed in the console when running
swa start
!
ℹ️ NOTE: Make sure to enable debug logs when running any swa
commands using --verbose=silly
Describe the bug
Angular app with managed API, need to have a configuration file with the following information
{ "platform": { "apiRuntime": "node:XX" } }
or deployment stage fails without error being displayed. This should have blocker priority, because there is absolutely no indication of cause of error that the developer can intuitively fix on their own.
When running with verbose, we have more information, additionally referring to the lack of a config.file, although it’s not marked as error but warning and you cannot infer the build fails for that reason.
To Reproduce
1 - create an angular app with Angular CLI
2 - create an HTTP trigger function under ./api with func CLI
3- create a service for the app to request the endpoint
4 - test locally with swa CLI (swa
+ swa start
)
5 - execute swa deploy
. The deploy will begin and abruptly abort without error in log after the message deploying to preview.
Expected behavior At minimum the CLI should display output information explaining that a configuration file with platform.apiRuntime config should be created by the user, and a link to documentation.
Ideally, the platform should auto-detect the runtime version and spare the user from having to configure and maintain this configuration file on their own, to configure an item required by the system and not the app.
Screenshots Already provided.
Desktop (please complete the following information):
- OS Monterey 12.6
- SWA CLI 1.0.3
- Angular 14.0.2
- Node v16.16.0
- npm version 8.11.0
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Thanks for reporting this @anfibiacreativa, we should definitely provide better logs/auto-detection to help guide the experience. For context for others reading, this is related to the requirement that the api runtime needs to be configured in staticwebapp.config.json as documented here: https://azure.github.io/static-web-apps-cli/docs/cli/swa-deploy#deploy-a-front-end-app-with-an-api
Hey @anfibiacreativa , we did a new STaticSiteClient release recently and you should be able to see the logs when deployment failure happens, please check this now.