-
Notifications
You must be signed in to change notification settings - Fork 166
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
Is TimeTrigger supported? #185
Comments
I can confirm I am having the same issue. |
Thanks for reporting this. We were able to repro this. Our binding metadata generation from the Function attributes has some mismatches. |
Would be nice to consolidate information here with Azure/azure-functions-dotnet-worker-preview#14 |
@ankitkumarr Has anything been released to fix this issue? |
@dmytro-gokun, we released |
@ankitkumarr , the trigger is happing now, but I got this error: |
I get the same error
|
@ankitkumarr I'm getting the same error as other guys. Is there any workaround for that? Here's what I'm refrencing:
|
@ankitkumarr Actually, would not it be nice if there were a TimeTrigger example in this repository? Then it would be easier for people to see how to use it and you will be able to test it quickly if something did not work :) |
Hi, I apologize for the delay here. As you may have read from our announcement -- because .NET 5 functions run as an out-of-proc execution model, "rich" types that were available in the inproc model for .NET 3 and lower are not supported out of the box yet. In this case, that's why However, you could also create a POCO with the required properties and use that instead of public class MyInfo
{
public MyScheduleStatus ScheduleStatus { get; set; }
/// <summary>
/// Gets a value indicating whether this timer invocation
/// is due to a missed schedule occurrence.
/// </summary>
public bool IsPastDue { get; set; }
}
public class MyScheduleStatus
{
/// <summary>
/// Gets or sets the last recorded schedule occurrence.
/// </summary>
public DateTime Last { get; set; }
/// <summary>
/// Gets or sets the expected next schedule occurrence.
/// </summary>
public DateTime Next { get; set; }
/// <summary>
/// Gets or sets the last time this record was updated. This is used to re-calculate Next
/// with the current Schedule after a host restart.
/// </summary>
public DateTime LastUpdated { get; set; }
} And then you can define your function like -- [FunctionName("Function6")]
public static void Run([TimerTrigger("0 */1 * * * *")] MyInfo myTimer,
FunctionExecutionContext executionContext)
{
var logger = executionContext.Logger;
logger.LogInformation($"message logged {myTimer.ScheduleStatus.Next} ");
} @dmytro-gokun, that's a good idea. We will add an example in this repo for TimerTrigger shortly. |
@ankitkumarr Thanks for the update. Finally, I was able to run this function locally. However, it still would not run on Azure:
and this is expected as I'm running on consumption plan which does not seem to have .NET 5.0 installed. Am I missing something here? |
@dmytro-gokun are you still experiencing issues in Azure? Have you followed the configuration information instructions here? |
@fabiocav I'm not sure why you talking about App Service here. What i have is a Function using Consumption Plan. When I create that, I do not have any way to select ".NET": Furthermore, after it's created, i do not have any means to change to edit "Stack Settings". May be i have to enable some "early access" settings on the Portal to be able to do that? |
@dmytro-gokun hey just following up to see whether you have resolved the issue running the function app on Azure? |
@azho472 I've decided not to waste time on it anymore and wait for it to be released. Obviously, these "previews" are very low priority with MS and they do not care to allocate any serious resources to fix all these issues or at least comment here. |
@dmytro-gokun I'm sorry you're getting that impression, but I can assure you that isn't the case. I'm transferring this issue to the Worker repo where you can track the activity, releases and announcements. The original issue should be addressed in the latest previews and you can see a collection of samples (including timer) here: https://github.com/Azure/azure-functions-dotnet-worker/tree/main/samples/SampleApp |
Also, reading through the thread and for clarity, Functions runs on App Service (consumption and dedicated/app service plans) . The link I provided applies to both models and enables .NET 5 for the site. |
@fabiocav Thanks for the update.
Please check the screenshot above. When using Consumption App Service Plan you do NOT have "Stack settings" under "Configuration" -> "General settings". That is the problem and that's why I asked if I needed to enable something on the portal so see that. I've now re-read the article at the link you've posted and I do not see anything like that. It just claims that .NET 5 should be available already. And it is, but only when using a dedicated App Service Plan. So, i'm still left in the limbo here. I am willing to give this preview one more try, but I cannot since all our functions use Consumption Plan. Any advice? |
I'm having trouble getting my TimerTriggers working on Azure as well. I have a service bus trigger that works fine, but the timers aren't firing. We are running on the premium plan, so don't have an explicit option to change to .NET 5, but if that was the problem wouldn't the service bus trigger fail as well? I just updated to preview 5 today hoping that would work, but no such luck. |
@fabiocav Any chance you can help with this issue. Or is it's just we should accept that this out of process thing does not work with Consumption Plans and wait for .NET 6 (or 7?). I'm totally confused. |
@sccrgoalie1 -- do you know how you created your app? Missing that storage setting would cause some issues so we should try to prevent it wherever we can. |
I believe I added a slot in the Azure portal and then deployed as described in the readme |
Closing this issue as it looks like all questions/issues have been addressed. If there are any remaining questions, please feel free to open a new issue. Thank you, all! |
Getting this error:
The text was updated successfully, but these errors were encountered: