az webapp create with invalid app service plan name throws: 'NoneType' object has no attribute 'location'
This is autogenerated. Please review and update as needed.
Describe the bug
I tried to create a webapp with an invalid app service plan and got this error:
az webapp create -n mvpsdkdemoapp -g groupname --plan azsdkdemoplan
az webapp create: error: 'NoneType' object has no attribute 'location'
Command Name
az webapp create
Errors: az webapp create: error: 'NoneType' object has no attribute 'location'
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Put any pre-requisite steps here...
az webapp create -n {} --plan {}
Expected Behavior
Environment Summary
Windows-10-10.0.18362-SP0
Python 3.6.6
azure-cli 2.2.0
Additional Context
azsdke2e
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI, @antcp.
thanks for reporting, route to appropriate team
Can you run the command with --debug with the same scenario & check the error message is more informative. Unfortunately this is a by design issue where the API returns a default error message and to see the internal error message you need use the --debug flag.
msrest.http_logger : Response content:
msrest.http_logger : {"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.Web/serverFarms/azsdkdemoplan123' under resource group 'mvpsdkdemorg' was not found."}}
usage: az webapp create [-h] [--verbose] [--debug]
[--output {json,jsonc,table,tsv,yaml,yamlc,none}]
[--query JMESPATH] [--subscription _SUBSCRIPTION]
--resource-group RESOURCE_GROUP_NAME --name NAME
--plan PLAN [--runtime RUNTIME]
[--startup-file STARTUP_FILE]
[--deployment-container-image-name DEPLOYMENT_CONTAINER_IMAGE_NAME]
[--deployment-source-url DEPLOYMENT_SOURCE_URL]
[--deployment-source-branch DEPLOYMENT_SOURCE_BRANCH]
[--deployment-local-git]
[--docker-registry-server-password DOCKER_REGISTRY_SERVER_PASSWORD]
[--docker-registry-server-user DOCKER_REGISTRY_SERVER_USER]
[--multicontainer-config-type {COMPOSE,KUBE}]
[--multicontainer-config-file MULTICONTAINER_CONFIG_FILE]
[--tags [TAGS [TAGS ...]]]
az webapp create: error: 'NoneType' object has no attribute 'location'
Thank you for the response. this error message "The Resource 'Microsoft.Web/serverFarms/azsdkdemoplan123' under resource group 'mvpsdkdemorg' was not found."}}" is the detailed message.
Yeah, can we expose that error message to the user without having to add --debug?
We have requested our API folks to make the changes on their end - in general polish/improve the default error message. For CLI the way to show the inner error message is to run using the debug flag
- 'NoneType' object has no attribute 'location' is not a good default error message.
- The CLI could own parsing the inner message and displaying it.
I don't see how API changes are needed for this.
CLI doesn't create a error messages but displays whatever the API returns. CLI does parse inner error message but only when run by --debug flag.
"'NoneType' object has no attribute 'location'" comes from the API? -
Seems like we should update the CLI to parse the inner message and display without --debug. Maybe one level deep? Else, we'll keep seeing this type of stuff pop up.
move to S169
We are planning on adding better validation & will test the during those fixes.
@calvinsID can you check if this is fixed by any of the validations you added. Moving to next milestone.
Fixed with newer versions of CLI