question

AdamKimberley-9495 avatar image
0 Votes"
AdamKimberley-9495 asked AdamKimberley-9495 edited

Bicep Deploy of Azure Functions and Event Grid Fails with BadRequest InternalServerError

I have a bicep file which I am using to deploy my Azure Function App in addition to a custom Event Grid Topic and Subscriptions. The Subscriptions have the Functions as their endpoints. When I try to deploy this bicep file using az deployment group create I get the following error:

{"status":"Failed","error":{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"BadRequest","message":"{\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\",\r\n \"Target\": null,\r\n \"Details\": [\r\n {\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n },\r\n {\r\n \"Code\": \"BadRequest\"\r\n },\r\n {\r\n \"ErrorEntity\": {\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n }\r\n }\r\n ],\r\n \"Innererror\": null\r\n}"},{"code":"BadRequest","message":"{\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\",\r\n \"Target\": null,\r\n \"Details\": [\r\n {\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n },\r\n {\r\n \"Code\": \"BadRequest\"\r\n },\r\n {\r\n \"ErrorEntity\": {\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n }\r\n }\r\n ],\r\n \"Innererror\": null\r\n}"},{"code":"BadRequest","message":"{\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\",\r\n \"Target\": null,\r\n \"Details\": [\r\n {\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n },\r\n {\r\n \"Code\": \"BadRequest\"\r\n },\r\n {\r\n \"ErrorEntity\": {\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n
}\r\n }\r\n ],\r\n \"Innererror\": null\r\n}"},{"code":"BadRequest","message":"{\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\",\r\n \"Target\": null,\r\n \"Details\": [\r\n {\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n },\r\n {\r\n \"Code\": \"BadRequest\"\r\n },\r\n {\r\n \"ErrorEntity\": {\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n }\r\n }\r\n ],\r\n \"Innererror\": null\r\n}"},{"code":"BadRequest","message":"{\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\",\r\n \"Target\": null,\r\n \"Details\":
[\r\n {\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n },\r\n {\r\n \"Code\": \"BadRequest\"\r\n },\r\n {\r\n \"ErrorEntity\": {\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered
an error (InternalServerError) from host runtime.\"\r\n }\r\n }\r\n ],\r\n \"Innererror\": null\r\n}"},{"code":"BadRequest","message":"{\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\",\r\n \"Target\": null,\r\n \"Details\": [\r\n {\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n },\r\n {\r\n \"Code\": \"BadRequest\"\r\n },\r\n {\r\n \"ErrorEntity\": {\r\n \"Code\": \"BadRequest\",\r\n
\"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n }\r\n }\r\n ],\r\n \"Innererror\": null\r\n}"},{"code":"BadRequest","message":"{\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\",\r\n \"Target\": null,\r\n \"Details\": [\r\n {\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n },\r\n {\r\n \"Code\": \"BadRequest\"\r\n },\r\n {\r\n \"ErrorEntity\": {\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n }\r\n }\r\n ],\r\n \"Innererror\": null\r\n}"},{"code":"BadRequest","message":"{\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\",\r\n \"Target\": null,\r\n \"Details\": [\r\n {\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n },\r\n {\r\n \"Code\": \"BadRequest\"\r\n },\r\n {\r\n \"ErrorEntity\": {\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (InternalServerError) from host runtime.\"\r\n }\r\n }\r\n ],\r\n \"Innererror\": null\r\n}"}]}}


When I attempt to redeploy via the Portal using the Deployments section of the Resource Group, I can see that it's a different set of functions that fails to deploy each time (this seems to be non-deterministic).

I'm completely stuck at the moment. Not quite sure what to try next. Any help would be hugely appreciated. Thanks!


[198487-mainbicep.txt][1]
[1]: /answers/storage/attachments/198487-mainbicep.txt





azure-functionsazure-event-grid
mainbicep.txt (28.2 KiB)
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AdamKimberley-9495 Thanks for reaching out. Could you check whether your functions app is up and running and do you have active triggers in it? If your function app is not up running, you can use Azure Functions Diagnostics run diagnose and solve problems to trouble shoot the issue.

Using Azure function Diagnostics also, If you are not able resolve/identify the issue.You can share me the error message details, operation id/correlation id, operation time frame (UTC)/timeStamp(UTC) when you are try to deploy and the deployment got failed

0 Votes 0 ·

@VenkateshDodda-MSFT Thanks for getting back to me. The Function App does seem to be running and the Functions that throw the errors also seem to have been deployed. However, my issue is that the Event Grid Subscriptions do not get deployed for the Functions that throw the errors. So, even though the Function App gets deployed ok, the errors cause my Event Grid Subscriptions to not deploy properly.

Here are the details of the failed deployment:

Start time:5/4/2022, 9:23:25 AM

Correlation ID:c1a66249-e24c-43a5-8975-abcf439318e0

Thanks for your help.

0 Votes 0 ·

@AdamKimberley-9495 Thanks for your response. Looking at the backend logs we see the same error at my end as well and we didn't see any retry attempt for that deployment request. Can you please retry the deployment and if you still see the error help us with error message, timeframe (UTC) and provide the updated template accordingly to troubleshoot further.

0 Votes 0 ·

@VenkateshDodda-MSFT Thanks again for your reply. I have now attempted a redeploy and I am getting the same error (but for a different set of functions). Here are the details:

Start time:5/5/2022, 9:01:24 AM

Correlation ID:c4523426-6fd4-4daf-b7df-4234eaa3a80d

Error Status Message:

 {
     "status": "Failed",
     "error": {
         "code": "BadRequest",
         "message": "Encountered an error (InternalServerError) from host runtime.",
         "details": [
             {
                 "message": "Encountered an error (InternalServerError) from host runtime."
             },
             {
                 "code": "BadRequest"
             },
             {}
         ]
     }
 }

I have one of those error messages for each function that fails. I have attached a screenshot of the resulting deployment.

199154-capture.png



Unfortunately, I cannot attach a copy of the deployment template as it contains sensitive information. If you are unable to retrieve a copy on the backend, please let me know and I will send you a redacted copy.

Many thanks for your help!

0 Votes 0 ·
capture.png (82.1 KiB)
Show more comments

0 Answers