Saurabh Rana
Saurabh Rana

Reputation: 167

Azure function fails after publishing another function in the same function app but works fine on publishing it again

I have an azure function Function1 in a function app. It executes fine on running it.

I have another azure function Function2 in the same function app.

Whenever I publish Function2, Function1 starts failing with the below error message:

2019-09-10T13:07:42  Welcome, you are now connected to log-streaming service. The default timeout is 2 hours. Change the timeout with the App Setting SCM_LOGSTREAM_TIMEOUT (in seconds). 
2019-09-10T13:08:26.994 [Info] Function started (Id=57101022-3a64-4a00-b67a-ff7628f0e2a8)
2019-09-10T13:08:27.510 [Error] Function completed (Failure, Id=57101022-3a64-4a00-b67a-ff7628f0e2a8, Duration=519ms)
2019-09-10T13:08:27.666 [Info] Function started (Id=550ac91a-63fb-4901-bac5-54c65d24807b)
2019-09-10T13:08:27.697 [Error] Function completed (Failure, Id=550ac91a-63fb-4901-bac5-54c65d24807b, Duration=22ms)
2019-09-10T13:08:27.775 [Info] Function started (Id=9af54597-3f1f-433b-aa5b-2ca5d7551d67)
2019-09-10T13:08:27.838 [Error] Function completed (Failure, Id=9af54597-3f1f-433b-aa5b-2ca5d7551d67, Duration=60ms)
2019-09-10T13:08:27.885 [Info] Function started (Id=c6439dbb-e4b1-4d43-8bd6-f088af00c10d)
2019-09-10T13:08:27.916 [Error] Function completed (Failure, Id=c6439dbb-e4b1-4d43-8bd6-f088af00c10d, Duration=28ms)
2019-09-10T13:08:27.978 [Info] Function started (Id=607081f0-4156-42de-9df3-281b2dac08ae)
2019-09-10T13:08:28.025 [Error] Function completed (Failure, Id=607081f0-4156-42de-9df3-281b2dac08ae, Duration=42ms)
2019-09-10T13:08:28.072 [Info] Function started (Id=8087f651-a85f-4496-8373-665d5777052b)
2019-09-10T13:08:28.135 [Error] Function completed (Failure, Id=8087f651-a85f-4496-8373-665d5777052b, Duration=50ms)
2019-09-10T13:08:28.181 [Info] Function started (Id=92ce5540-ea45-4c18-8189-ba90659b5c09)
2019-09-10T13:08:28.213 [Error] Function completed (Failure, Id=92ce5540-ea45-4c18-8189-ba90659b5c09, Duration=39ms)
2019-09-10T13:08:28.260 [Info] Function started (Id=2a344ba3-dd5f-49b2-ab06-60d0667d12cb)
2019-09-10T13:08:28.322 [Error] Function completed (Failure, Id=2a344ba3-dd5f-49b2-ab06-60d0667d12cb, Duration=46ms)
2019-09-10T13:08:28.369 [Info] Function started (Id=f48005e9-2220-48a1-bab3-032a5f99b6fe)
2019-09-10T13:08:28.400 [Error] Function completed (Failure, Id=f48005e9-2220-48a1-bab3-032a5f99b6fe, Duration=31ms)
2019-09-10T13:08:28.447 [Info] Function started (Id=6b494d51-49c5-4701-a4d4-5b4b1e6f2b65)
2019-09-10T13:08:28.478 [Error] Function completed (Failure, Id=6b494d51-49c5-4701-a4d4-5b4b1e6f2b65, Duration=32ms)

As we see in the above error message it has only the logs of

[Info] Function started (Id=57101022-3a64-4a00-b67a-ff7628f0e2a8)

and

[Error] Function completed (Failure, Id=57101022-3a64-4a00-b67a-ff7628f0e2a8, Duration=519ms)

and the execution does not even go inside the function.

I have a solution for this problem. That is to republish Function1 and the error goes away and the Functions executes fine.

How can I avoid the need to republish Function1 everytime I publish Function2 as a workaround to avoid the error mentioned above?

Thank You

Upvotes: 1

Views: 697

Answers (1)

jeffhollan
jeffhollan

Reputation: 3227

It’s worth clarifying that for functions the unit of deployment is the entire app. You can’t just publish or update an individual function without also publishing the entire app.

In terms of what may be causing the issue I’m not positive. One place to look is how you are publishing. In the last year we introduced run from package which enables you to publish a single zip artifact. If you don’t have this option enabled, it’s possible that some files are getting copied over while function1 is still trying to execute and it ends up in a bad state. If that’s the case enabling run-from-package should resolve your issues (should be a checkbox in Visual Studio publish, or on by default in VS Code).

Upvotes: 1

Related Questions