Skip to content

[BUG] API returns error when updating existing mongo cluster #31377

Open

Description

API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/mongocluster/resource-manager/Microsoft.DocumentDB/stable/2024-07-01/mongoCluster.json#L279

API Spec version

2024-07-01

Describe the bug

When updating an existing mongocluster through the MongoClusters_CreateOrUpdate API using the response returned by the MongoClusters_Get API, an error was received, the update operation failed.

Expected behavior

Update should succeed. The API shouldn't care if this is set (like most of the other Azure APIs).

Actual behavior

Update failed, the API returns the following error.

{"error":{"code":"bad_request","message":"Found schema errors for api-version 2024-07-01. Errors: The property '#/systemData' of type null did not match the following type: object in schema 25debcc2-6915-5536-9566-a2ecd765b755"}}

Reproduction Steps

  • Step1: Get an existing mongocluster which compute tier is free.
GET /subscriptions/.../resourceGroups/acctestRG-241101100238280187/providers/Microsoft.DocumentDB/mongoClusters/acctest-mc241101100238280187?api-version=2024-07-01 HTTP/1.1
X-Ms-Correlation-Request-Id: 95471b42-6c6b-a3e0-af45-b43d8cc12b27


AzureRM Response:
HTTP/2.0 200 OK
Date: Fri, 01 Nov 2024 02:12:58 GMT
X-Ms-Correlation-Request-Id: 95471b42-6c6b-a3e0-af45-b43d8cc12b27

{
  "id": "/subscriptions/.../resourceGroups/acctestRG-241101100238280187/providers/Microsoft.DocumentDB/mongoClusters/acctest-mc241101100238280187",
  "name": "acctest-mc241101100238280187",
  "type": "Microsoft.DocumentDB/mongoClusters",
  "tags": {
  },
  "location": "eastus",
  "systemData": {
    "createdAt": "2024-11-01T02:03:51.3222716Z",
    "createdBy": "e0228b2d-03d1-4463-b866-a871d418a0be",
    "createdByType": "Application",
    "lastModifiedAt": "2024-11-01T02:03:51.3222716Z",
    "lastModifiedBy": "e0228b2d-03d1-4463-b866-a871d418a0be",
    "lastModifiedByType": "Application"
  },
  "properties": {
    "provisioningState": "Succeeded",
    "clusterStatus": "Ready",
    "administrator": {
      "userName": "admintest"
    },
    "serverVersion": "6.0",
    "compute": {
      "tier": "Free"
    },
    "storage": {
      "sizeGb": 32
    },
    "sharding": {
      "shardCount": 1
    },
    "highAvailability": {
      "targetMode": "Disabled"
    },
    "connectionString": "mongodb+srv://<user>:<password>@acctest-mc241101100238280187.mongocluster.cosmos.azure.com/?tls=true&authMechanism=SCRAM-SHA-256&retrywrites=false&maxIdleTimeMS=120000",
    "backup": {
    },
    "privateEndpointConnections": [

    ],
    "publicNetworkAccess": "Enabled",
    "infrastructureVersion": "1.0"
  }
}
  • Step2: Using the data response in Step 1, update only the compute tier from free to M30 .
PUT /subscriptions/.../resourceGroups/acctestRG-241101100238280187/providers/Microsoft.DocumentDB/mongoClusters/acctest-mc241101100238280187?api-version=2024-07-01 HTTP/1.1
X-Ms-Correlation-Request-Id: 95471b42-6c6b-a3e0-af45-b43d8cc12b27

{
   "id":"/subscriptions/.../resourceGroups/acctestRG-241101100238280187/providers/Microsoft.DocumentDB/mongoClusters/acctest-mc241101100238280187",
   "location":"eastus",
   "name":"acctest-mc241101100238280187",
   "properties":{
      "administrator":{
         "userName":"adminTest"
      },
      "backup":{
         
      },
      "clusterStatus":"Ready",
      "compute":{
         "tier":"M30"
      },
      "connectionString":"mongodb+srv://\u003cuser\u003e:\u003cpassword\u003e@acctest-mc241101100238280187.mongocluster.cosmos.azure.com/?tls=true\u0026authMechanism=SCRAM-SHA-256\u0026retrywrites=false\u0026maxIdleTimeMS=120000",
      "highAvailability":{
         "targetMode":"Disabled"
      },
      "infrastructureVersion":"1.0",
      "privateEndpointConnections":[
         
      ],
      "provisioningState":"Succeeded",
      "publicNetworkAccess":"Enabled",
      "serverVersion":"6.0",
      "sharding":{
         "shardCount":1
      },
      "storage":{
         "sizeGb":32
      }
   },
   "systemData":null,
   "tags":{
      
   },
   "type":"Microsoft.DocumentDB/mongoClusters"
}

AzureRM Response:
HTTP/2.0 400 Bad Request
Date: Fri, 01 Nov 2024 02:13:01 GMT
X-Ms-Correlation-Request-Id: 95471b42-6c6b-a3e0-af45-b43d8cc12b27


{"error":{"code":"bad_request","message":"Found schema errors for api-version 2024-07-01. Errors: The property '#/systemData' of type null did not match the following type: object in schema 25debcc2-6915-5536-9566-a2ecd765b755"}}


Environment

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

MgmtThis issue is related to a management-plane library.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions