Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.61k stars 5.03k forks source link

[BUG] Cannot reset a dbforpostgresql Configuration via PUT #30143

Open thomas11 opened 1 month ago

thomas11 commented 1 month ago

API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/Configuration.json

API Spec version

2022-12-01

Describe the bug

The Postgres Flexible Server CLI docs state

If you want to reset the value of a parameter, you simply choose to leave out the optional --value parameter, and the service applies the default value.

The spec defines both PUT and PATCH for this endpoint, seemingly identical. However, only PATCH works for the reset use case. PUT results in InternalServerError.

Expected behavior

Ideally, PUT should also work to reset a Configuration.

At least, the server should return a useful error message rather than "internal error".

Actual behavior

HTTP Request Begin PUT https://management.azure.com/subscriptions/123/resourceGroups/deleteme488fffb2/providers/Microsoft.DBforPostgreSQL/flexibleServers/deletemefbe4ffe8/configurations/azure.extensions?api-version=2022-12-01 {"properties":{}}

HTTP Response Begin PUT [https://management.azure.com/subscriptions/123/resourceGroups/deleteme488fffb2/providers/Microsoft.DBforPostgreSQL/flexibleServers/deletemefbe4ffe8/configurations/azure.extensions?api-version=2022-12-01 HTTP/2.0 500 Internal Server Error {"error":{"code":"InternalServerError","message":"An unexpected error occured while processing the request. Tracking ID: '57b96ac5-25a1-41ae-bfae-b7fdeaf36ef8'"}}

Reproduction Steps

see the requests above

Environment

No response

v-jiaodi commented 1 month ago

@ambrahma Please help take a look, thanks.

Stadly commented 3 weeks ago

Any news on this?

ambrahma commented 2 weeks ago

Any news on this?

We have created an internal bug to look into this. We haven't got chance to review this issue and hence no ETA as yet. Tagging @nasc17 for this issue

nasc17 commented 1 week ago

Hi @thomas11 thank you for bringing this to our attention.

I first want to confirm, when you send in {"properties":{}} with PATCH you do not get InternalServerError and the server parameter sets to its default value?

When sending either request, if value and source are null an error should be returned. For cli, the code sets the two properties by providing the default value and source as "user-override". The default value can be found in cli by using the az postgres flexible-server parameter show command.