Azure / static-web-apps-cli

Azure Static Web Apps CLI ✨

Home Page:https://aka.ms/swa/cli-local-development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deploy from terminal shows no error when failing

BrainCrumbz opened this issue · comments

Running swa --version result:
1.1.6

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

None of the above, we think. We're running CLI from windows terminal and we're not passing any port argument. And not port argument is shown in the output.

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
In a scenario when deploy command fails, and this is due to a rejected request with code BadRequest, CLI simply terminates midway, without any error message.
In our specific case, failure was due to the size of app content being too large.

To Reproduce
Steps to reproduce the behavior:

  1. Create a dummy web site and configure it to deploy it through swa
  2. In public site directory copy dummy contents for more than 500 MB. This is in order to exceed Azure Static Web App allowed content size and let deploy operation fail
  3. From terminal run swa command to deploy site: swa deploy --env Production

Expected behavior
Console output should show an error regarding the request rejected by server and the reason for it. And anyway it should be explicit that operation failed.

Actual behavior
Console output shows no error. swa execution just stops midway, and one may think that operation was successful. Here's the final part of the output:

Deploying to environment: Production

Deploying project to Azure Static Web Apps...

Only by running the deploy command with -V silly argument, we were able to figure out what was happening. Here's the final part of the output:

ℹ The content server has rejected the request with: BadRequest
ℹ Reason: The size of the app content was too large. The limit for this Static Web App is 524288000 bytes.
ℹ For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/
ℹ If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/

Screenshots
Not needed

Desktop (please complete the following information):

  • OS: Windows
  • Version: 11 23H2

Additional context
We also checked issues #781 and #783 but they do not seem a clone of this one.

Hi @BrainCrumbz , thanks for reporting this, we will output the error message if the deployment got the BadRequest.

By the way, the reason of this issue is that the "Free" SKU of static web apps has a limitation of the content size. And swa-cli only supports creating swa with SKU: Free currently. So apps with large content size should be created from Azure Portal with SKU: Standard before run "swa deploy".

@cjk7989 thanks for the additional info on content size. Although in our case we were exceeding the Standard SKU max content size too.