question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Operation returned an invalid status 'Bad Request' when trying to set a custom domain

See original GitHub issue

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug

To Reproduce

Run az staticwebapp hostname set -n jamcloud --hostname blog.domain.com returns Operation returned an invalid status ‘Bad Request’

cli.azure.cli.core.sdk.policies: Response content: cli.azure.cli.core.sdk.policies: {“Code”:“BadRequest”,“Message”:“The maximum number of custom domains allowed for this static site is 2.”,“Target”:null,“Details”:[{“Message”:“The maximum number of custom domains allowed for this static site is 2.”},{“Code”:“BadRequest”},{“ErrorEntity”:{“ExtendedCode”:“59334”,“MessageTemplate”:“The maximum number of custom domains allowed for this static site is {0}.”,“Parameters”:[“2”],“Code”:“BadRequest”,“Message”:“The maximum number of custom domains allowed for this static site is 2.”}}],“Innererror”:null} cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception: cli.azure.cli.core.util: Traceback (most recent call last): File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/knack/cli.py”, line 231, in invoke cmd_result = self.invocation.execute(args) File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py”, line 658, in execute raise ex File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py”, line 721, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py”, line 692, in _run_job result = cmd_copy(params) File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py”, line 328, in call return self.handler(*args, **kwargs) File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py”, line 121, in handler return op(**command_args) File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/appservice/static_sites.py”, line 117, in set_staticsite_domain return sdk_no_wait(no_wait, client.begin_create_or_update_static_site_custom_domain, File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/cli/core/util.py”, line 678, in sdk_no_wait return func(*args, **kwargs) File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/mgmt/web/v2021_01_15/operations/_static_sites_operations.py”, line 2464, in begin_create_or_update_static_site_custom_domain raw_result = self._create_or_update_static_site_custom_domain_initial( File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/mgmt/web/v2021_01_15/operations/_static_sites_operations.py”, line 2409, in _create_or_update_static_site_custom_domain_initial raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) azure.core.exceptions.HttpResponseError: Operation returned an invalid status ‘Bad Request’

cli.azure.cli.core.azclierror: Operation returned an invalid status ‘Bad Request’ az_command_data_logger: Operation returned an invalid status ‘Bad Request’

Expected behavior

We should include the error message “The maximum number of custom domains allowed for this static site is 2.”

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
panchagnulacommented, Feb 16, 2022

The error here is that the quota has reached “The maximum number of custom domains allowed for this static site is 2.” @StrawnSC can we show the detailed error message by default on SWA command?

1reaction
Kaheracommented, Mar 21, 2022

The same goes for az staticwebapp create where the error message is RepositoryToken is invalid. Please ensure the repository exists and the RepositoryToken is for an admin of the repository.

This also only outputs Bad Request.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enable-AzCdnCustomDomainHttps: Operation returned an ...
Description I'm trying to use the cmdlet ... following error: Operation returned an invalid status code 'BadRequest'. ... Cdn.CustomDomain.
Read more >
New-AzCdnProfile: Operation returned an invalid status ...
I have pay-as-you-go subscription and i only have one cdn profile in different resource group and i want to create new cdn profile...
Read more >
Azure – Operation returned an invalid status code 'BadRequest'
The command try to create the automation account in “France South” location in the “RG_INFRA” resource group. The error message was not explicit...
Read more >
How to Fix a 400 Bad Request Error: 8 Easy Methods
Stuck with a 400 bad request error? Read this article to find out 8 simple methods to solve the problem and its possible...
Read more >
Common REST API error codes - Azure Storage
Error code HTTP status code User message AccountAlreadyExists Conflict (409) The specified account already exists. AccountIsDisabled Forbidden (403) The specified account is disabled. AccountProtectedFromDeletion Conflict (409)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found