Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with [app service] / API Version [2023-01-01] #957

Open
1 task done
xiaxyi opened this issue Apr 5, 2024 · 4 comments
Open
1 task done

Issue with [app service] / API Version [2023-01-01] #957

xiaxyi opened this issue Apr 5, 2024 · 4 comments

Comments

@xiaxyi
Copy link

xiaxyi commented Apr 5, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Service Used

Microsoft.Web

API Versions Used

2023-01-01

Description

The api "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}" supports both LRO/ non-LRO.

the LRO is for function app on container app environment, however, the LRO poller returns error(check code #1) if the result of the polling uri is statusCode 200 + actual function app object. (we only take 200 + empty body as a succeeded polling op: see code #2)
1.

if op.Properties.ProvisioningState == "" && op.Status == "" {
			return nil, fmt.Errorf("expected either `provisioningState` or `status` to be returned from the LRO API but both were empty")
		}
	// Automation@2022-08-08 - Runbooks - returns a 200 OK with no Body
		if result.HttpResponse.StatusCode == http.StatusOK && result.HttpResponse.ContentLength == 0 {
			result.Status = pollers.PollingStatusSucceeded
			return
		}

It makes sense to return the actual provisioned object by the polling uri endpoint, shall we add this scenario as well?

related issue: #542

References

No response

@tombuildsstuff
Copy link
Contributor

@xiaxyi can you provide the HTTP Requests/Responses involved here?

@xiaxyi
Copy link
Author

xiaxyi commented Apr 5, 2024

sure @tombuildsstuff , here you go:
The PUT request to create the function app on container:
https://management.azure.com/subscriptions/85xxx/resourcegroups/xiaxintestrg-linuxOnContainer/providers/Microsoft.Web/sites/xiaxintest-tf-acr130-api?api-version=2023-01-01

{
  "name": "xiaxintest-tf-acr130-api",
  "kind": "functionapp,linux,container,azurecontainerapps",
  "location": "eastus",
  "properties": {
    "managedEnvironmentId": "/subscriptions/85bxxx/resourceGroups/xiaxintestrg-linuxOnContainer/providers/Microsoft.App/managedEnvironments/xiaxintest-CAEnv",
    "siteConfig": {
      "appSettings": [
        { "name": "FUNCTIONS_EXTENSION_VERSION", "value": "~4" },
        {
          "name": "AzureWebJobsStorage",
          "value": "DefaultEndpointsProtocol=https;AccountName=xiaxintestsafacontainer;AccountKey=Dxxx;EndpointSuffix=core.windows.net"
        },
        {
          "name": "DOCKER_REGISTRY_SERVER_URL",
          "value": "xiaxintestacr.azurecr.io"
        },
        { "name": "DOCKER_REGISTRY_SERVER_USERNAME", "value": "xiaxintestacr" },
        { "name": "DOCKER_REGISTRY_SERVER_PASSWORD", "value": "xxxx },
        {
          "name": "AzureWebJobsDashboard",
          "value": "DefaultEndpointsProtocol=https;AccountName=xiaxintestsafacontainer;AccountKey=xxx;EndpointSuffix=core.windows.net"
        }
      ],
      "ftpsState": "Disabled",
      "linuxFxVersion": "DOCKER|xiaxintestacr.azurecr.io/azurefunctionsimage:v1.0.0",
      "use32BitWorkerProcess": false
    }
  },
  "tags": null
}

response body of the original URI is the function app object itself

when trying to get the Location in header, request:

https://management.azure.com/subscriptions/85bxxx/resourceGroups/xiaxintestrg-linuxOnContainer/providers/Microsoft.Web/sites/xiaxintest-tf-acr130-api/operationresults/0e10d606-58fe-4842-babd-844a7ac76d6e?api-version=2023-01-01&t=638479026176663501&c=MIIHADCCBeigAwIBAgITHgPpxUXboRMa1MKXpgAAA-nFRTANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjQwMTMxMDEyODE0WhcNMjUwMTI1MDEyODE0WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALigL_YnYGZkISCK9BFT_dzpf963u9bRlY_IhMLl8TQ-....

Before function app is provisioned the response is 202+empty body, after the function app is provisioned, response is 200 + actual function app object:
image

image

@tombuildsstuff
Copy link
Contributor

@xiaxyi have you got the full headers for both requests too?

@xiaxyi
Copy link
Author

xiaxyi commented Apr 8, 2024

Sure @tombuildsstuff
This is the header of the PUT request:

[
  {
    "key": "Cache-Control",
    "value": "no-cache"
  },
  {
    "key": "Pragma",
    "value": "no-cache"
  },
  {
    "key": "Expires",
    "value": "-1"
  },
  {
    "key": "Location",
    "value": "https://management.azure.com/subscriptions/85b3xxx/resourceGroups/xiaxintestrg-linuxOnContainer/providers/Microsoft.Web/sites/xiaxintest-tf-acr130-api/operationresults/caa81acc-27cc-4936-98eb-820d1390b080?api-version=2023-01-01&t=638481622558841711&c=MIIHADCCBeigAwIBAgITHgPr-xxx"
  },
  {
    "key": "Retry-After",
    "value": "15",
    "description": "Indicates how many seconds to wait before making a follow-up request.",
    "enabled": true,
    "disableEdit": true,
    "info": "Indicates how many seconds to wait before making a follow-up request."
  },
  {
    "key": "Strict-Transport-Security",
    "value": "max-age=31536000; includeSubDomains",
    "description": "Lets websites tell a browser that they should only be accessed via HTTPS.",
    "enabled": true,
    "disableEdit": true,
    "info": "Lets websites tell a browser that they should only be accessed via HTTPS."
  },
  {
    "key": "X-AspNet-Version",
    "value": "4.0.30319",
    "description": "Custom header",
    "enabled": true,
    "disableEdit": true,
    "info": "Custom header"
  },
  {
    "key": "X-Powered-By",
    "value": "ASP.NET"
  },
  {
    "key": "x-ms-ratelimit-remaining-subscription-resource-requests",
    "value": "499"
  },
  {
    "key": "x-ms-request-id",
    "value": "xxx"
  },
  {
    "key": "x-ms-correlation-request-id",
    "value": "xxx"
  },
  {
    "key": "x-ms-routing-request-id",
    "value": "xxx"
  },
  {
    "key": "X-Content-Type-Options",
    "value": "nosniff"
  },
  {
    "key": "X-Cache",
    "value": "CONFIG_NOCACHE"
  },
  {
    "key": "X-MSEdge-Ref",
    "value": "Ref A: xxx Ref B: xx Ref C: 2024-04-08T08:37:31Z"
  },
  {
    "key": "Date",
    "value": "Mon, 08 Apr 2024 08:37:35 GMT"
  },
  {
    "key": "Date",
    "value": "Mon, 08 Apr 2024 08:37:35 GMT"
  },
  {
    "key": "Content-Length",
    "value": "0"
  }
]

This is the header of the get async location :

[
  {
    "key": "Cache-Control",
    "value": "no-cache"
  },
  {
    "key": "Pragma",
    "value": "no-cache"
  },
  {
    "key": "Expires",
    "value": "-1"
  },
  {
    "key": "Location",
    "value": "https://management.azure.com/subscriptions/85xxx/resourceGroups/xiaxintestrg-linuxOnContainer/providers/Microsoft.Web/sites/xiaxintest-tf-acr130-api/operationresults/2d229b38-0695-4db4-a1fa-fabb3907dfb8?api-version=2023-01-01&t=638481627257729625&c=zMIIHADCCBeigAw"
  },
  {
    "key": "Retry-After",
    "value": "15"
  },
  {
    "key": "Strict-Transport-Security",
    "value": "max-age=31536000; includeSubDomains"
  },
  {
    "key": "X-AspNet-Version",
    "value": "4.0.30319"
  },
  {
    "key": "X-Powered-By",
    "value": "ASP.NET"
  },
  {
    "key": "x-ms-ratelimit-remaining-subscription-reads",
    "value": "11999"
  },
  {
    "key": "x-ms-request-id",
    "value": "xxx"
  },
  {
    "key": "x-ms-correlation-request-id",
    "value": "xxx"
  },
  {
    "key": "x-ms-routing-request-id",
    "value": "xxx"
  },
  {
    "key": "X-Content-Type-Options",
    "value": "nosniff"
  },
  {
    "key": "X-Cache",
    "value": "CONFIG_NOCACHE"
  },
  {
    "key": "X-MSEdge-Ref",
    "value": "Ref A: xxx Ref B: xxx Ref C: 2024-04-08T08:45:24Z"
  },
  {
    "key": "Date",
    "value": "Mon, 08 Apr 2024 08:45:25 GMT"
  },
  {
    "key": "Content-Length",
    "value": "0"
  }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants