azure-sdk-for-go icon indicating copy to clipboard operation
azure-sdk-for-go copied to clipboard

Some services DELETE APIs cannot be called with GenericClient BeginDelete

Open matthchr opened this issue 2 years ago • 9 comments

Bug Report

package: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/resourcemanager/resources/armresources/zz_generated_client.go sdk version: master/latest

I am using GenericClient BeginDelete to issue deletes for a bunch of resources including Event Hub Consumer Groups.

I have noticed though that I get a JSON deserialization error when deleting Event Hub Consumer groups. The actual error is

json: cannot unmarshal string into Go value of type ClientDeleteResponse

The reason for this error is that this API seems to return the string literal "". If you look at the implementation of the type-specific SDK, it never attempts to deserialize the response see here.

It feels like the async workflow + poller should be hardened for this case and allow me to successfully delete things via the async pattern?

Note that, this works for almost every resource I tried it for, so in some ways this could be an issue with eventhubs API, since what they are doing seems very strange...

matthchr avatar Jul 06 '22 16:07 matthchr

@matthchr Thanks for your feedback. We do have some logic to handle such sync operation with poller. The error happens when we try to unmarshall the response to a response object. Commonly, the service should return an {} instead of "" with no swagger response defined. Then SDK could unmarshall it to an empty response struct. @jhendrixMSFT What do you think?

tadelesh avatar Jul 07 '22 07:07 tadelesh

If there's no response schema defined, then the service shouldn't return anything. Is there a link to the swagger?

jhendrixMSFT avatar Jul 07 '22 14:07 jhendrixMSFT

If there's no response schema defined, then the service shouldn't return anything. Is there a link to the swagger?

@jhendrixMSFT Swagger is here. In armeventhub package, we will not unmarshall the response because no response schema defined, thus no error will happen. But in armresource package, the common deletion is an LRO which will fall back to NonPoller and the response unmarshall will fail.

tadelesh avatar Jul 08 '22 02:07 tadelesh

Thanks for the links. Given that the 200 response doesn't define a model, it really looks like a bug that they're returning anything. Can you please follow up with the event hubs team about this? Worse case we can harden against this, but I'd like to avoid that as I think their behavior is broken.

jhendrixMSFT avatar Jul 08 '22 15:07 jhendrixMSFT

Thanks @tadelesh for the investigation. Yes you have seen exactly what I was getting at. It's fine for their SDK because you never attempt to read the body, but in the generic client you do (via NonPoller).

@jhendrixMSFT did you want me to contact the eventhub team? Or @tadelesh? I don't have any contact on their team but I assume that you guys might? I do agree that this looks more like a service bug.

matthchr avatar Jul 08 '22 15:07 matthchr

Sorry, that was meant for @tadelesh.

jhendrixMSFT avatar Jul 08 '22 15:07 jhendrixMSFT

Thank you for your feedback. This has been routed to the support team for assistance.

msftbot[bot] avatar Jul 11 '22 05:07 msftbot[bot]

@matthchr @jhendrixMSFT I'll follow up with service team. @navba-MSFT Could you help to involve eventhub team?

tadelesh avatar Jul 11 '22 05:07 tadelesh

@tadelesh Adding Service team to look into this.

navba-MSFT avatar Jul 11 '22 05:07 navba-MSFT

@tadelesh, @RickWinter -- can we get the service teams attention here? Haven't seen any acknowledgement they've seen this issue.

matthchr avatar Nov 09 '22 18:11 matthchr

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

Issue Details

Bug Report

package: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/resourcemanager/resources/armresources/zz_generated_client.go sdk version: master/latest

I am using GenericClient BeginDelete to issue deletes for a bunch of resources including Event Hub Consumer Groups.

I have noticed though that I get a JSON deserialization error when deleting Event Hub Consumer groups. The actual error is

json: cannot unmarshal string into Go value of type ClientDeleteResponse

The reason for this error is that this API seems to return the string literal "". If you look at the implementation of the type-specific SDK, it never attempts to deserialize the response see here.

It feels like the async workflow + poller should be hardened for this case and allow me to successfully delete things via the async pattern?

Note that, this works for almost every resource I tried it for, so in some ways this could be an issue with eventhubs API, since what they are doing seems very strange...

Author: matthchr
Assignees: tadelesh, lirenhe
Labels:

bug, Event Hubs, Service Attention, Mgmt, customer-reported, needs-team-attention

Milestone: 2022-10

msftbot[bot] avatar Nov 10 '22 02:11 msftbot[bot]

@kasun04 , @Saglodha Could you help to take a look?

tadelesh avatar Nov 10 '22 02:11 tadelesh

@tadelesh , thanks for reaching out. Our team would investigate, and I would share updates soon.

Saglodha avatar Nov 11 '22 04:11 Saglodha

Hi @matthchr , @tadelesh - Our team investigated and could confirm a reported bug for similar issue which was fixed. Could you please retry the operation and confirm if you're still facing the issue?

Saglodha avatar Nov 22 '22 05:11 Saglodha

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

msftbot[bot] avatar Nov 29 '22 14:11 msftbot[bot]