Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.35k stars 4.71k forks source link

[BUG] - ACA Jobs - Stopping Job .Net SDK throwing The requested operation requires an element of type 'Object', but the target element has type 'String'. #44806

Open rahulsingii opened 3 months ago

rahulsingii commented 3 months ago

Library name and version

Azure.ResourceManager.AppContainers 1.2.0

Describe the bug

I have a simple container job which is triggered based on azure service bus. I am successfully able to stop the job replica using the command line. I then tried stopping it through the .Net SDK following the sample mentioned in documentation. It is stopping the job but throwing exception in the final method:-

await containerAppJobExecution.StopExecutionJobAsync(WaitUntil.Completed);

Exception Message -

The requested operation requires an element of type 'Object', but the target element has type 'String'.

Stack Trace -

at System.Text.Json.ThrowHelper.ThrowJsonElementWrongTypeException(JsonTokenType expectedType, JsonTokenType actualType) at System.Text.Json.JsonDocument.TryGetNamedPropertyValue(Int32 index, ReadOnlySpan1 propertyName, JsonElement& value) at System.Text.Json.JsonElement.TryGetProperty(String propertyName, JsonElement& value) at Azure.Core.NextLinkOperationImplementation.IsFinalState(Response response, HeaderSource headerSource, Nullable1& failureState, String& resourceLocation) at Azure.Core.NextLinkOperationImplementation.Create(HttpPipeline pipeline, RequestMethod requestMethod, Uri startRequestUri, Response response, OperationFinalStateVia finalStateVia, Boolean skipApiVersionOverride, String apiVersionOverrideValue) at Azure.ResourceManager.AppContainers.AppContainersArmOperation..ctor(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, Boolean skipApiVersionOverride, String apiVersionOverrideValue) at Azure.ResourceManager.AppContainers.ContainerAppJobExecutionResource.d__18.MoveNext()

Expected behavior

Job is stopping but SDK shouldn't throw exception.

Actual behavior

Exception is thrown.

Reproduction Steps

  1. Create the container app job provided in the sample.
  2. Try stopping a particular job replica using the .Net SDK.

Environment

Project version - .Net 8

jsquire commented 3 months ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.

HarveyLink commented 2 months ago

Hi @rahulsingii , thank you for using Azure SDK for .NET. Based on the service spec

         "responses": {
          "200": {
            "description": "Container Apps Jobs terminated successfully."
          },

The response should not contain any content. But now the content is:

"Job Execution: <placeholder>, stopped successfully."

This is not we expected. You could open an Azure support request to let ContainerAPP service team change the response.

github-actions[bot] commented 2 months ago

Hi @rahulsingii. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

rahulsingii commented 2 months ago

@HarveyLink - Thank you for your response. Can't the SDK team be assigned here instead? I am getting no help from Azure support plus it doesn't seem to be my subscription issue so maybe it should be addressred here? /unresolve @jsquire

jsquire commented 2 months ago

@rahulsingii : Not sure why I've been mentioned here, as my role was just to perform initial triage. That said, to clarify Minghao's analysis, this behavior is the result of the service not following its own published API spec. The Azure SDK package has no insight nor influence over the service behavior, which is clearly in error.

Looping in @ArthurMa1978 as the management package owner. Do you agree with the recommended path, or should there be an internal IcM for the service team opened to push for a fix?

HarveyLink commented 2 months ago

We have reached out the service team, they will apply a fix to this issue, will comment back once we have further updates.

github-actions[bot] commented 2 months ago

Hi @rahulsingii, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.

rahulsingii commented 2 months ago

/unresolve