-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Resource should exist before deployment. Cannot read property 'getApplicationURL' of undefined. #15532
Comments
Hello tomred-net Thanks |
Hi, @v-ibshaik The App Service Plan and App Services exist and can be seen when querying the az resource list. The query name matches the search name. This is the cleaned up output:
You will see the request that is failing is the filter resources by name and type. It is either the double escaping of the / in the Microsoft.Web%252FSites or if the query is case sensitive the use of S instead of s in sites as you can see the name matches the following result.
This is the result of a az resource list command.
|
Hi @tomred-net Could you please share the details like how you are creating the resources. Is it created via pipelines before deployment or already exists? Thank you. |
Hi @v-saikumart, The App Service and App Service Plan resources are created using Terraform and have been provisioned for the last week. They can be deployed to through the portal and from terraform without issue. The serviceConnection works for other deployments such as static apps. The deployment step for the container is as follows:
|
Can you share the details that you are experiencing the issue consistently or just immediately after creating app from terraform. And can you please run the mentioned GET API call from postman and confirm on same. Thank you. |
HI @v-saikumart, I am experiencing this consistently. The query from the request fails:
When I fix the URL encoding it passes
|
Hi @tomred-net Thank you. |
@v-saikumart as demonstrated in my previous reply I tried the first url (containing 'Microsoft.Web%252FSites' ) which is the same as the value submitted by the azure task and the result is an empty array.
If I replace the double url encoding of '/' then I get the successful results as shown in my previous answer. To clarify / is encoded to %2f which appears to be re-encoded to %252f as original % is encoded as %25. |
@v-saikumart @v-ibshaik is there anything else I can do to help you debug this issue? |
@tomred-net Could you please share the below mentioned details, as we are try to reproduce the issue and it is working as expected. i. Complete Pipeline logs. Thank you. |
Were you able to find a fix for this? I am experiencing a similar issue, but it is sporadic.
Up until yesterday this was working and now sometimes it works and other times it fails. Error:
|
I am also seeing the exact message. Was working up until today |
I've been trying to deploy my function app all day, exact same steps and error at the end. Using the |
Just started working today! I hope it's a permanent fix... |
Hi @v-saikumart, I am sorry I did not receive a notification of you edits to your original reply, hence I did not notice the request for more information. I will run the deployment now and extract the logs. It is still failing for the same reason. Dermot |
Please find attached both the log file and the azure-pipeline.yml |
@RSteeno No fix so far. It is still happening for us. |
@tomred-net Thank you for the response. We will investigate further and share the status accordingly. |
Same problem for me and my team of 15 devs, this is heavily impacting us currently. The only difference to the behavior reported by @tomred-net is that is does not fail always, but very often. This is even more annoying. |
I have an case open with MSFT. The engineer referenced an ongoing Resource Manager issue dated Jan 13th which could be related. |
@tomred-net Could please verify the SPN role and confirm the web app(request-to-pay-service) is present in that subscription(PAYGO Subscription). |
I too am dealing with this issue and have a support case open with MS. Please let me know if there is anything I can provide to assist in resolving this issue as it is causing a lot of issues for our devs. I also want to point out that this is happening with our function deployments as well. |
We ran into the same issue this week (EU West) with 2 newly created function apps. We tried some things on our end to fix it, but nothing seems to have helped: It seems to have magically resolved itself |
Wow, it's hitting a year now, with this issue still unresolved. |
Just experienced this error on a new function app as well (test stage) - been trying the deployment for 2 hours with no luck. Has been working fine on dev stage |
Just started experiencing a similar issue in South Africa North. Was working fine in late November, now its giving an error about not being able to get the resource ID |
We are still experiencing this issue for our Terraform/Devops pipelines. Workarounds are not 100% reliable, delays do work, but are increasing the duration of our pipelines by a lot. Resource creation and deployment via local machine with user credentials does not seem to have this problem. |
It's 2023 and after 1 year of the first post, this hasn't yet been resolved. In our case, we are trying to move resources from one region to another. Functions don't have the "Move" option and therefore we need to delete it, re-create it and then go into DevOps to redeploy the code. I understand the existing/old Pipeline (in Azure DevOps) will fail because the resource (ID) changed. Here's what I usually try: 1 - Refresh the existing Steps to force a Resource ID update (the dropdowns) Nothing, I repeat, NOTHING guarantees that the next pipeline run will work. What works is just "wait for a random period and" try again. I sincerely don't understand why this is still a thing. |
Hi Guys, Just hit the issue today. Will it be fixed? |
Hi Guys! I've commented here long time ago. This issue basically roots in the inconsistency of the distributed storage in which Azure stores our resources metadata. When we create/update resources, they metadata initially gets stored in one (or at least, not in all the) location and as time goes it gets replicated to multiple metadata stores. Because of this delay, we can reach "ARM endpoints" which do not know about our resource creation/update yet. So it can happen that with your first call you are creating a resource which's metadata is stored in location A, and as a next step you try to deploy on it from Azure Pipelines (for example) but that deployment checks the existence of your resource in location B which simply does not contain your previous updates yet. |
I have just started getting this today - its really infuriating. My app did deploy once, but has failed before and since. I just created a brand new App Service and I am getting the same error on that (never seen it before on hundreds of others I have created over the years) Got service connection details for Azure App Service:'RevelationMoonAdminNew' |
@borondy same option the support gave us last year, I think Azure should make the feature GA... |
Same issue here. Between this issue and the intermittent 'service unavailable (code 503)' when it tries to mount the zip, function app deployments are painful right now. |
Sounds like this should be how it works behind the scene by default. At its current state, the Azure iac pipeline implementation is unstable and simply just broken. I wonder why Microsoft is sleeping on this? |
In the end it turns out the CLI is more reliable. So we used the solution previously mentioned.
|
I got the same issue when deloying to the new-created App Service. I had to wait for 2 days and try again, now the name of that App Service appears in the App Service name of Azure App Service deploy task (version: 4.*) in the Release pipeline. |
I am getting the same issue still with web app deploys. Going to try to implement the CLI workaround, but it is a bit disappointing that Azure still has this issue. |
I was getting this error with deploying to a new App Service with v4 ( I tried several times ). It worked with v3, after which I was immediately able to switch back to v4 and it worked. |
Because it is a nasty bug, nothing more.
czw., 18 maj 2023 o 12:22 Greig Stewart ***@***.***>
napisał(a):
… I was getting this error with deploying to a new App Service with v4 ( I
tried several times ). It worked with v3, after which I was immediately
able to switch back to v4 and it worked.
—
Reply to this email directly, view it on GitHub
<#15532 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIAUSZ4WAY4X47FQIMWDD63XGXZ77ANCNFSM5ISNBOOA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Yesterday I faced the below error when deploying function app via Azure Devops yaml pipeline:
Interestingly, another pipeline with the same steps worked fine. The only difference was, different service principals (ADO service connections) were used in the two pipelines. After comparing the service principals I found that mine had RBAC permissions on multiple subscriptions (including the function app subscription) where as the working one had permissions on only one subscription containing function app. The Fix was simple - I created a new service principal with permissions to only the function app and related resources in same subscription. So "az account show" gives only one subscription in the output. This is more of a workaround, but Hope it helps someone. |
Any update? Lately it started becoming more and more unstable. I've also tried having the reset azure cache suggested, added 10 retries on the task and it is still failing. |
Any update? I'm a teacher and was teaching Azure DevOps Pipelines to my students using this code and tutorial from mslearn and we are experimenting the same issue... It's very frustrating, as students don't know if they're configuring something wrong or there is any other problem. It's the same issue described on nov 2021... I also tried adding delays between ARM taks and deploy task but it continues failing ramdonly. The code students are using is here For specifying the pipelines we are using the classic editor (as it's the first time they are configuring pipelines) The deployment.json is here https://github.com/ETSISI-EMS/mslearn-tailspin-spacegame-web/blob/main/azuredeploy.json The error of deploy task is as follows: |
also it would make sense that it would fail the first time the resources are created because it needs some delay but once the resources are created, why does the deploy fail? also why does it fail randomly? |
Starting seeing this issue of "resource not found" since this weekend, probably about the same timeframe as @jdiazfernandez . Pipeline exists for more than a year, all deployments successful, until Sunday... no real means to troubleshoot, as 'it just happened'. |
Didn't change anything in the pipeline definition, but it started working again today. for both WebApp deployments as well as Functions. Hopefully it is stabilized again... |
Unfortunately it isn't :(, switching my pipelines over from the default AzureWebApp and AzureFunction tasks to the CLI alternatives, as those seem to be more stable... |
In my case the issue was caused by insufficient permissions. I had to assign Website Contributor role to the service principal. |
It is very likely that permissions had nothing to do with it; but rather while you were adjusting permissions, Azure replication completed. |
Nothing to do with permissions. I had this issue randomly in the past |
Note
Issues in this repo are for tracking bugs, feature requests and questions for the tasks in this repo
For a list:
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks
If you have an issue or request for the Azure Pipelines service, use developer community instead:
https://developercommunity.visualstudio.com/spaces/21/index.html )
Required Information
Entering this information will route you directly to the right team and expedite traction.
Question, Bug, or Feature?
Type: Bug
Enter Task Name:
list here (V# not needed):
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks
Environment
https://dev.azure.com/Wych/Platform/_build/results?buildId=1730&view=logs&j=d1f3ad78-87a3-52d4-781d-88cb006f9122&t=3ca6baf2-e6c7-575f-3171-0693595489c7
Issue Description
Azure Web App Deployment can't find existing Microsoft.Web/sites
##[debug]Deployment Failed with Error: Error: Resource '...xxxx...' doesn't exist. Resource should exist before deployment.
This appears to be because the query is case sensitive:
##[debug][GET]https://management.azure.com/subscriptions/a1dc7c64-6f29-4584-90a3-a65732d701af/resources?$filter=resourceType EQ 'Microsoft.Web%252FSites' AND name EQ 'request-to-pay-service'&api-version=2016-07-01
Microsoft.Web%252FSites >Microsoft.Web/Sites but the correct value (and the value that is in other deployment strings is Microsoft.Web/sites note the lower case s in sites.
[Include task name(s), screenshots and any other relevant details]
Task logs
##[debug]{"subscriptionID":"","subscriptionName":"","servicePrincipalClientID":"","environmentAuthorityUrl":"https://login.windows.net/","tenantID":"***","url":"https://management.azure.com/","environment":"AzureCloud","scheme":"ServicePrincipal","activeDirectoryResourceID":"https://management.azure.com/","azureKeyVaultServiceEndpointResourceId":"https://vault.azure.net","azureKeyVaultDnsSuffix":"vault.azure.net","scopeLevel":"Subscription","authenticationType":"***","servicePrincipalKey":***,"isADFSEnabled":false,"applicationTokenCredentials":{"clientId":"***","domain":"***","baseUrl":"https://management.azure.com/","authorityUrl":"https://login.windows.net/","activeDirectoryResourceId":"https://management.azure.com/","isAzureStackEnvironment":false,"authType":"***","secret":***,"isADFSEnabled":false}}
Got service connection details for Azure App Service:''
##[debug][POST]https://login.windows.net/***/oauth2/token/
##[debug][GET]https://management.azure.com/subscriptions/***/resources?$filter=resourceType EQ 'Microsoft.Web%252FSites' AND name EQ ''&api-version=2016-07-01
##[debug]Correlation ID from ARM api call response : b79bdf30-6fd1-4ff5-97af-955641ac01b3
##[debug]Deployment Failed with Error: Error: Resource '' doesn't exist. Resource should exist before deployment.
(node:1722) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getApplicationURL' of undefined
at ContainerWebAppDeploymentProvider. (/home/vsts/work/_tasks/AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1/4.184.4/deploymentProvider/AzureRmWebAppDeploymentProvider.js:54:73)
##[debug]task result: Failed
at Generator.next ()
##[error]Error: Resource '***' doesn't exist. Resource should exist before deployment.
##[debug]Processed: ##vso[task.issue type=error;]Error: Resource 'request-to-pay-service' doesn't exist. Resource should exist before deployment.
Troubleshooting
Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting
Error logs
[Insert error from the logs here for a quick overview]
The text was updated successfully, but these errors were encountered: