azure-sdk-for-go: Http 400 Preflight validation check error `the operation failed or was cancelled` needs detailed message

Bug Report

I’m testing preflight validation function with an unsupported location (e.g australiacentral) for todo-nodejs-mongo-aks. The error message is the operation failed or was cancelled. The error message should provide a detailed message on why it is failing.

I debugged and this is the error message that got skipped: The template deployment '****' is not valid according to the validation procedure. The tracking id is '****'. See inner errors for details. Preflight validation check for resource(s) for container service *** in resource group ****** failed. Message: Virtual Machine size: '' is not supported for subscription ***** in location 'australiacentral'. Please refer to aka.ms/aks/vm-size-selector to find supported VM sizes in location 'australiacentral'. This message is necessary for users to debug and should be provided in error message.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 19 (10 by maintainers)

Most upvoted comments

I can add some debugging notes here since I was fortunate enough to be present with @hemarina at the time, but I do believe this is a bug in the Swagger spec that is used to generate deployment_clients.go.

Here’s the execution flow we observed:

  1. Client calls BeginValidate in deployment_clients.go.
  2. ARM returns 400 Bad Request
  3. validate checks for Bad Request, but considers it a success state, it returns httpResp, nil instead of nil, err.
  4. Execution continues until NewPoller, where it’s rejected by the validation check.

In summary, the bug observed by the user is:

  • When ARM returns 400 bad request for deployments/validate, the error the operation failed or was cancelled is returned instead of the expected azcore.ResponseError.

We are also happy to provide a minimal repro setup, but it boils down to calling deploymentsClient.BeginValidate with parameters that will result in an ARM 400 response.