Azure / Azure-Functions

1.12k stars 198 forks source link

Document deployment options related to trigger syncing #210

Closed lindydonna closed 5 years ago

lindydonna commented 7 years ago

When using a Consumption or Premium plan, any changes to triggers that are made to function.json will be synced with the central listener when using the following deployment options:

The following deployment options will not sync triggers on a Consumption Plan, aside from HTTP triggers:

In order to synchronize triggers when these deployment options are used, open the Azure Portal and click the Refresh button, or make a API call to the sync triggers endpoint: https://github.com/davidebbo/AzureWebsitesSamples/blob/master/ARMTemplates/FunctionsWebDeploy.json#L90

Powershell sample: https://github.com/davidebbo/AzureWebsitesSamples/blob/master/PowerShell/HelperFunctions.ps1#L360-L365

tohling commented 6 years ago

@jeffhollan, note sure if you are the right person to ask, but is it possible to expedite an official documentation on this?

jeffhollan commented 6 years ago

Just stumbled on this from a blog link - apologies I missed the initial notification. This does seem like a doc we should work to track - especially with Run-from-zip options starting to light up in tools like VS and VSTS. While most tools at this point should be syncing triggers, is the world where people modify files outside of a standard deployment path and do need to know about this. @ggailey777 @tdykstra can you create a P1 item on the doc backlog to have an article (or append existing) around deployment options. Would likely link to docs like the one on ZipDeploy, but I think layout would be:

  1. Explain different options available (Portal create, WebDeploy, ZipDeploy, and Run-from-Zip) and meaning of each (or link to full doc where we have them)
  2. Explain "trigger syncing" and when it may be applicable (run-from-zip pointed to an external file, or one of options called out on original issue)
iizotov commented 5 years ago

Please add some clarity around the WEBSITE_RUN_FROM_PACKAGE method.

Looks like the Event Hub trigger doesn't get registered upon a successful deployment via WEBSITE_RUN_FROM_PACKAGE either. What's weird is that pinging the Function (via its URI or the Portal) kicks the trigger off but the Function a) never scales beyond 1 instance and b) eventually falls asleep. Only the Restart operation seems to kick it off properly.

Also, worth documenting explicitly that setting the SCM_DO_BUILD_DURING_DEPLOYMENT flag to "true" does not have any impact when using WEBSITE_RUN_FROM_PACKAGE, e.g. no npm or nuget packages will be restored during the deployment process.

aluong commented 5 years ago

It would be helpful to document this in the developer section of the public docs, because it is not intuitive that this call is necessary is certain deployment situations.

ColbyTresness commented 5 years ago

I kind of disagree with this issue - shouldn't trigger sync be an implementation detail @paulbatum? Happy to include in things like our wiki, but from my perspective, this should be something that we fix, not document better.

paulbatum commented 5 years ago

@ColbyTresness Unfortunately we do not have a timeline for when it becomes a pure implementation detail. Couple of examples:

We will keep chipping away at this problem but neglecting to document this is a case of "perfect is the enemy of good".

ColbyTresness commented 5 years ago

Fair enough, I think its worth investigating improving the public docs around deployments. But I don't think we should explicitly mention SyncTriggers or how it works.

jeffhollan commented 5 years ago

@ColbyTresness are you going to track this? Per other thread on how if you are using WEBSITE_RUN_FROM_PACKAGE={externalURL} you need to manually sync triggers to get it to work at all. So in order to document that deployment gesture we'll need to reference some doc that explains what call they need to make and what it does. I'm not a huge fan either FWIW but it is what it is.

Let me know - expect either yourself, Asavari, me, or Glenn should be owner and making sure this gets delivered in next few weeks

ColbyTresness commented 5 years ago

I'll do it.

m-mertz commented 5 years ago

Can you post the necessary ARM API call here in the meantime until the official doc gets updated? Powershell is not an option for our scenario unfortunately.

Update: Actually the Fluent SDK provides IFunctionApp.SyncTriggersAsync() so we're unblocked for now. Might still be a good idea to provide the API call if the doc is not updated soon.

ggailey777 commented 5 years ago

@ColbyTresness we already have a work item (1108377) open to track sync triggers related stuff.

There's also a work item for a general deployment options article (1108365).

egorchabala commented 5 years ago

Is there any updates on this? Do you have any estimates when this can be fixed?

ColbyTresness commented 5 years ago

No real estimate, but it's in progress. It'll hopefully get done within April.

egorchabala commented 5 years ago

@ColbyTresness have you had implemented the fix?

ColbyTresness commented 5 years ago

I've finished my work and it's being reviewed, this will be released within a week or two.

aluong commented 5 years ago

Related to documenting the sync triggers usages, can we also correct the Rest API Spec as well, because it actually affects the expected responses in the client SDKs? Ex: the Azure Python SDKs will actually throw an exception when it receives a 200 response after calling SyncTriggers.

secureaiexplorer commented 5 years ago

Hi Folks,

I stumbled upon this thread as I was facing a similar issue:

https://github.com/Azure/azure-webjobs-sdk/issues/2220

@ColbyTresness can you comment if I might be running in to this problem.

secureaiexplorer commented 5 years ago

I have been using "func azure publish functionap" to update my Javascript.

linker-err0r commented 5 years ago

Any updates on this issue? I've been using VS Code extension to push and test functions. Some of my functions have ceased triggering. @lindydonna 's suggestion is... opaque to me. Can someone explain to me how to get my triggers working again? Like I'm 5? I think I understand the concept that triggers can be out of sync, but I'm not clear on what I need to do or refresh to fix it in my scenario as I'm not familiar with Azure backend terminology. I just want to get my functions to work...

This is also happening on my local, not just deployed.

jeffhollan commented 5 years ago

@ColbyTresness you mentioned to me you were almost done with this doc? Any ETA?

jeffhollan commented 5 years ago

However @deathgaze it should be noted syncing triggers is an Azure Functions service specific gesture. When running local it’s unnecessary as there’s no scaling involved (from zero or to n). So if you’re having troubles with a trigger locally likely a separate issue.

ColbyTresness commented 5 years ago

Yeah this was delayed from 3 weeks ago, but I promise it will be released soon (I've finished the edits and review, now just waiting to publish to docs). My doc should have the clear explanation of trigger syncing you're looking for - will link to it here when it's complete.

ColbyTresness commented 5 years ago

I've merged this into master and it will be published shortly. Titled "Functions deployment technologies" when released (tomorrow I believe).

ColbyTresness commented 5 years ago

https://docs.microsoft.com/en-us/azure/azure-functions/functions-deployment-technologies

Ruud-cb commented 4 years ago

After digging I have found this issue, yet when I review my deployment and function, it should be working fine. I have similar issues with Azure storage queue falling asleep. In AppInsights I see trace logs for each queue: Stopped the listener '{listenerName}' for function '{functionName}'.

Anything else I can test? Or should I move on to open a new issue elsewhere?

paulbatum commented 4 years ago

@Ruud-cb Yes performing a zip deploy from devops should not require any manual trigger sync actions. If you haven't already done so, I recommend you file a support ticket - you can do that directly from the Azure portal. Alternatively, file a new issue in https://github.com/Azure/azure-functions-host and fill out the template so that we have enough information to investigate.