Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.
https://aka.ms/azd
MIT License
402 stars 195 forks source link

[Issue] Function App Deploy: Inconsistent on Consumption vs. Premium Plan #3209

Open mattgotteiner opened 8 months ago

mattgotteiner commented 8 months ago

Output from azd version Run azd version and copy and paste the output here: azd version 1.5.1 (commit 3856d1e98281683b8d112e222c0a7c7b3e148e96)

Describe the bug Description of issue you're seeing...

From another issue #2012 azd checks api/deployment/latest for deployment to function apps. This works consistently when you use a premium plan, but occasionally fails when deploying to a linux consumption plan with the following error:

 azd deploy

Deploying services (azd deploy)

  (x) Failed: Deploying service api

ERROR: failed deploying service 'api': failing invoking action 'deploy', GET https://func-api-yvxujhed7pxw4.scm.azurewebsites.net:443/api/deployments/latest
--------------------------------------------------------------------------------
RESPONSE 404: 404 Not Found
ERROR CODE UNAVAILABLE
--------------------------------------------------------------------------------
Deployment 'latest' not found.
--------------------------------------------------------------------------------

TraceID: 1799bd90c56c4cf4fdc799e3b65b2cd2

To Reproduce Steps to reproduce the behavior...

Run azd deploy with any function on a linux consumption plan. Service should be defined in azure.yaml like the following:

services:
  api:
    project: ./api/functions
    language: python
    host: function

Expected behavior A clear and concise description of what you expected to happen.

azd deploy works consistently regardless of the underlying app service plan

Environment Information on your environment:

python, vscode

Additional context Add any other context about the problem here.

azd debug output from a successful debug (truncated )

azd deploy --debug
2024/01/19 09:24:55 main.go:54: azd version: 1.5.1 (commit 3856d1e98281683b8d112e222c0a7c7b3e148e96)
2024/01/19 09:24:55 project.go:113: Reading project from file 'C:\Users\magottei\source\azure-search-vector-samples\demo-python\code\custom-embeddings\azure.yaml'
2024/01/19 09:24:55 main.go:208: using cached latest version: 1.5.1 (expires on: 2024-01-20T17:14:52Z)
2024/01/19 09:24:55 cobra_builder.go:141: Resolved action 'azd-deploy-action'
2024/01/19 09:24:55 middleware.go:124: running middleware 'debug'
2024/01/19 09:24:55 middleware.go:124: running middleware 'experimentation'
2024/01/19 09:24:55 experimentation.go:42: assignment context: 0g5ad841:76970;
2024/01/19 09:24:55 middleware.go:124: running middleware 'telemetry'
2024/01/19 09:24:55 telemetry.go:50: TraceID: d8cc950bd31950f89f5cf8c7cd3bde9c
2024/01/19 09:24:55 middleware.go:124: running middleware 'hooks'
2024/01/19 09:24:55 hooks.go:156: service 'api' does not require any command hooks.
2024/01/19 09:24:55 command_runner.go:307: Run exec: 'py --version' , exit code: 0
-------------------------------------stdout-------------------------------------------
Python 3.10.11
2024/01/19 09:24:55 python.go:49: python version: Python 3.10.11

Deploying services (azd deploy)

  |     ==| Deploying service api (Compressing deployment artifacts)2024/01/19 09:24:58 main.go:48: Retry: =====> Try=1
2024/01/19 09:24:58 main.go:48: Request: ==> OUTGOING REQUEST (Try=1)
   GET https://management.azure.com/subscriptions/ee787b9b-a25f-4d20-86e9-45fcea5253dd/resourceGroups/rg-ls2/resources?%24filter=REDACTED&api-version=2021-04-01
   Accept: application/json
   Authorization: REDACTED
   User-Agent: azsdk-go-armresources/v1.0.0 (go1.21.0 X:loopvar; Windows_NT),azdev/1.5.1 (Go go1.21.0 X:loopvar; windows/amd64)
   X-Ms-Correlation-Request-Id: d8cc950bd31950f89f5cf8c7cd3bde9c

  |       | Deploying service api (Compressing deployment artifacts)2024/01/19 09:24:58 main.go:48: Response: ==> REQUEST/RESPONSE (Try=1/347.1745ms, OpTime=347.1745ms) -- RESPONSE RECEIVED
   GET https://management.azure.com/subscriptions/ee787b9b-a25f-4d20-86e9-45fcea5253dd/resourceGroups/rg-ls2/resources?%24filter=REDACTED&api-version=2021-04-01
   Accept: application/json
   Authorization: REDACTED
   User-Agent: azsdk-go-armresources/v1.0.0 (go1.21.0 X:loopvar; Windows_NT),azdev/1.5.1 (Go go1.21.0 X:loopvar; windows/amd64)
   X-Ms-Correlation-Request-Id: d8cc950bd31950f89f5cf8c7cd3bde9c
   --------------------------------------------------------------------------------
   RESPONSE Status: 200 OK
   Cache-Control: no-cache
   Content-Type: application/json; charset=utf-8
   Date: Fri, 19 Jan 2024 17:24:58 GMT
   Expires: -1
   Pragma: no-cache
   Strict-Transport-Security: REDACTED
   Vary: REDACTED
   X-Content-Type-Options: REDACTED
   X-Ms-Correlation-Request-Id: d8cc950bd31950f89f5cf8c7cd3bde9c
   X-Ms-Ratelimit-Remaining-Subscription-Reads: REDACTED
   X-Ms-Request-Id: fcaa6194-6d88-4428-bb8e-6c78294d3f5c
   X-Ms-Routing-Request-Id: REDACTED

2024/01/19 09:24:58 main.go:48: Retry: response 200
2024/01/19 09:24:58 main.go:48: Retry: exit due to non-retriable status code
  |      =| Deploying service api (Uploading deployment package)2024/01/19 09:24:58 main.go:48: Retry: =====> Try=1
2024/01/19 09:24:58 main.go:48: Request: ==> OUTGOING REQUEST (Try=1)
   POST https://func-api-yvxujhed7pxw4.scm.azurewebsites.net/api/zipdeploy?isAsync=REDACTED
   Accept: application/json
   Authorization: REDACTED
   Content-Type: application/octet-stream
   User-Agent: azsdk-go-zip-deploy/1.0.0 (go1.21.0 X:loopvar; Windows_NT),azdev/1.5.1 (Go go1.21.0 X:loopvar; windows/amd64)
   X-Ms-Correlation-Request-Id: d8cc950bd31950f89f5cf8c7cd3bde9c

  |       | Deploying service api (Uploading deployment package)2024/01/19 09:25:55 main.go:48: Response: ==> REQUEST/RESPONSE (Try=1/57.385838s, OpTime=57.385838s) -- RESPONSE RECEIVED
   POST https://func-api-yvxujhed7pxw4.scm.azurewebsites.net/api/zipdeploy?isAsync=REDACTED
   Accept: application/json
   Authorization: REDACTED
   Content-Type: application/octet-stream
   User-Agent: azsdk-go-zip-deploy/1.0.0 (go1.21.0 X:loopvar; Windows_NT),azdev/1.5.1 (Go go1.21.0 X:loopvar; windows/amd64)
   X-Ms-Correlation-Request-Id: d8cc950bd31950f89f5cf8c7cd3bde9c
   --------------------------------------------------------------------------------
   RESPONSE Status: 202 Accepted
   Content-Length: 0
   Date: Fri, 19 Jan 2024 17:25:55 GMT
   Location: REDACTED
   Retryafter: REDACTED
   Scm-Deployment-Id: REDACTED
   Server: Kestrel
   Set-Cookie: REDACTED

2024/01/19 09:25:55 main.go:48: Retry: response 202
2024/01/19 09:25:55 main.go:48: Retry: exit due to non-retriable status code
2024/01/19 09:25:55 main.go:48: LongRunningOperation: BEGIN PollUntilDone() for *azsdk.deployPollingHandler
2024/01/19 09:25:55 main.go:48: Retry: =====> Try=1
2024/01/19 09:25:55 main.go:48: Request: ==> OUTGOING REQUEST (Try=1)
   GET https://func-api-yvxujhed7pxw4.scm.azurewebsites.net:443/api/deployments/latest?deployer=REDACTED&time=REDACTED
   Authorization: REDACTED
   User-Agent: azsdk-go-zip-deploy/1.0.0 (go1.21.0 X:loopvar; Windows_NT),azdev/1.5.1 (Go go1.21.0 X:loopvar; windows/amd64)
   X-Ms-Correlation-Request-Id: d8cc950bd31950f89f5cf8c7cd3bde9c

2024/01/19 09:25:56 main.go:48: Response: ==> REQUEST/RESPONSE (Try=1/124.251ms, OpTime=124.8091ms) -- RESPONSE RECEIVED
   GET https://func-api-yvxujhed7pxw4.scm.azurewebsites.net:443/api/deployments/latest?deployer=REDACTED&time=REDACTED
   Authorization: REDACTED
   User-Agent: azsdk-go-zip-deploy/1.0.0 (go1.21.0 X:loopvar; Windows_NT),azdev/1.5.1 (Go go1.21.0 X:loopvar; windows/amd64)
   X-Ms-Correlation-Request-Id: d8cc950bd31950f89f5cf8c7cd3bde9c
   --------------------------------------------------------------------------------
   RESPONSE Status: 202 Accepted
   Content-Length: 471
   Content-Type: application/json; charset=utf-8
   Date: Fri, 19 Jan 2024 17:25:55 GMT
   Location: REDACTED
   Server: Kestrel
   Set-Cookie: REDACTED

2024/01/19 09:25:56 main.go:48: Retry: response 202
2024/01/19 09:25:56 main.go:48: Retry: exit due to non-retriable status code
2024/01/19 09:25:56 main.go:48: LongRunningOperation: delay for 10s
....

  |===    | Deploying service api (Fetching endpoints for function app)2024/01/19 09:30:33 main.go:48: Response: ==> REQUEST/RESPONSE (Try=1/762.7119ms, OpTime=762.7119ms) -- RESPONSE RECEIVED
   GET https://management.azure.com/subscriptions/ee787b9b-a25f-4d20-86e9-45fcea5253dd/resourceGroups/rg-ls2/providers/Microsoft.Web/sites/func-api-yvxujhed7pxw4?api-version=2021-03-01
   Accept: application/json
   Authorization: REDACTED
   User-Agent: azsdk-go-armappservice/v1.0.0 (go1.21.0 X:loopvar; Windows_NT),azdev/1.5.1 (Go go1.21.0 X:loopvar; windows/amd64)
   X-Ms-Correlation-Request-Id: d8cc950bd31950f89f5cf8c7cd3bde9c
   --------------------------------------------------------------------------------
   RESPONSE Status: 200 OK
   Cache-Control: no-cache
   Content-Type: application/json
   Date: Fri, 19 Jan 2024 17:30:33 GMT
   Etag: "1DA4AFC204192F5"
   Expires: -1
   Pragma: no-cache
   Server: Microsoft-IIS/10.0
   Strict-Transport-Security: REDACTED
   Vary: REDACTED
   X-Aspnet-Version: REDACTED
   X-Content-Type-Options: REDACTED
   X-Ms-Correlation-Request-Id: d8cc950bd31950f89f5cf8c7cd3bde9c
   X-Ms-Ratelimit-Remaining-Subscription-Reads: REDACTED
   X-Ms-Request-Id: 30c4b67b-cbf5-476c-a541-e15c6f5929e7
   X-Ms-Routing-Request-Id: REDACTED
   X-Powered-By: REDACTED

2024/01/19 09:30:33 main.go:48: Retry: response 200
2024/01/19 09:30:33 main.go:48: Retry: exit due to non-retriable status code
  (✓) Done: Deploying service api
wbreza commented 8 months ago

@mattgotteiner Outside of differences between premium vs consumption plan are there any other notable differences on the function app configuration around networking, etc?

Are you experiencing the same consumption app behaving different and occasionally failing? Is this a semi-consistent experience always or is it most likely to occur on the first deploy to the function app?

mattgotteiner commented 8 months ago
  1. No, no notable differences
  2. Deployment occasionally fails. Most likely to occur on first deploy, but may happen again on a re-deploy
mattgotteiner commented 8 months ago

More info: This seems to only happen when I include large files in the deployment. This might be a service issue and unrelated to azd