azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

az webapp create with invalid app service plan name throws: 'NoneType' object has no attribute 'location'

Open jongio opened this issue 6 years ago • 14 comments

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

jongio avatar Mar 17 '20 00:03 jongio

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI, @antcp.

ghost avatar Mar 17 '20 01:03 ghost

thanks for reporting, route to appropriate team

yungezz avatar Mar 17 '20 01:03 yungezz

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.

panchagnula avatar Mar 27 '20 20:03 panchagnula

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'

jongio avatar Mar 31 '20 17:03 jongio

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.

panchagnula avatar Mar 31 '20 17:03 panchagnula

Yeah, can we expose that error message to the user without having to add --debug?

jongio avatar Mar 31 '20 18:03 jongio

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

panchagnula avatar Mar 31 '20 18:03 panchagnula

  1. 'NoneType' object has no attribute 'location' is not a good default error message.
  2. The CLI could own parsing the inner message and displaying it.

I don't see how API changes are needed for this.

jongio avatar Mar 31 '20 18:03 jongio

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.

panchagnula avatar Mar 31 '20 18:03 panchagnula

"'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.

jongio avatar Mar 31 '20 18:03 jongio

move to S169

yonzhan avatar Apr 18 '20 12:04 yonzhan

We are planning on adding better validation & will test the during those fixes.

panchagnula avatar May 28 '20 06:05 panchagnula

@calvinsID can you check if this is fixed by any of the validations you added. Moving to next milestone.

panchagnula avatar Aug 18 '20 17:08 panchagnula

Fixed with newer versions of CLI

calvinsID avatar Aug 18 '20 18:08 calvinsID