Comments (24)
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 TimerInfo
isn't working out of the box. We could look into add some converter to at least support this type temporarily (cc: @brettsam @fabiocav).
However, you could also create a POCO with the required properties and use that instead of TimerInfo
in your function parameter. Here's an example --
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.
from azure-functions-dotnet-worker.
I can confirm I am having the same issue.
from azure-functions-dotnet-worker.
@dmytro-gokun, we released 1.0.0-preview2
versions of the Microsoft.Azure.Functions.Worker.Sdk
and Microsoft.Azure.Functions.Worker
yesterday in Nuget including the fix for TimerTrigger. Please try using that!
from azure-functions-dotnet-worker.
@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?
from azure-functions-dotnet-worker.
@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
from azure-functions-dotnet-worker.
Thanks for reporting this. We were able to repro this. Our binding metadata generation from the Function attributes has some mismatches.
We have put a fix in place for Timer trigger and will be releasing updated packages soon.
from azure-functions-dotnet-worker.
Would be nice to consolidate information here with Azure/azure-functions-dotnet-worker-preview#14
from azure-functions-dotnet-worker.
@ankitkumarr Has anything been released to fix this issue?
from azure-functions-dotnet-worker.
@ankitkumarr , the trigger is happing now, but I got this error:
[2021-01-08T03:25:20.012Z] Executing 'Functions.TimerTriggerFunction' (Reason='Timer fired at 2021-01-08T00:25:20.0115789-03:00', Id=065d5b8f-7f2c-4d68-8ab9-5fdffde7c7cb)
[2021-01-08T03:25:20.024Z] Executed 'Functions.TimerTriggerFunction' (Failed, Id=065d5b8f-7f2c-4d68-8ab9-5fdffde7c7cb, Duration=10ms)
[2021-01-08T03:25:20.028Z] System.Private.CoreLib: Exception while executing function: Functions.TimerTriggerFunction. System.Private.CoreLib: Result: Failure
Exception: Unable to convert to Microsoft.Azure.WebJobs.TimerInfo
Stack: at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionExecutor.ConvertParameter(ParameterInfo param, TypedData value, ParameterConverterManager converterManager) in D:\a\1\s\src\DotNetWorker\Invocation\DefaultFunctionExecutor.cs:line 117
from azure-functions-dotnet-worker.
I get the same error
[2021-01-09T05:19:00.014Z] Executing 'Functions.Timer01' (Reason='Timer fired at 2021-01-09T07:19:00.0129108+02:00', Id=beeb41df-e734-44fe-993e-30be57921bd4)
[2021-01-09T05:19:00.078Z] Executed 'Functions.Timer01' (Failed, Id=beeb41df-e734-44fe-993e-30be57921bd4, Duration=64ms)
[2021-01-09T05:19:00.085Z] System.Private.CoreLib: Exception while executing function: Functions.Timer01. System.Private.CoreLib: Result: Failure
Exception: Unable to convert to Microsoft.Azure.WebJobs.TimerInfo
Stack: at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionExecutor.ConvertParameter(ParameterInfo param, TypedData value, ParameterConverterManager converterManager) in D:\a\1\s\src\DotNetWorker\Invocation\DefaultFunctionExecutor.cs:line 117
[2021-01-09T05:19:00.086Z] at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionExecutor.ExecuteAsync(FunctionExecutionContext context) in D:\a\1\s\src\DotNetWorker\Invocation\DefaultFunctionExecutor.cs:line 60
[2021-01-09T05:19:00.088Z] at Microsoft.Azure.Functions.Worker.FunctionBroker.InvokeAsync(InvocationRequest invocationRequest) in D:\a\1\s\src\DotNetWorker\Broker\FunctionBroker.cs:line 44.
from azure-functions-dotnet-worker.
@ankitkumarr I'm getting the same error as other guys. Is there any workaround for that? Here's what I'm refrencing:
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="4.0.1" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.2" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.3" />
<PackageReference Include="Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator" Version="1.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.0.0-preview2" OutputItemType="Analyzer"/>
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.0.0-preview2" />
</ItemGroup>
from azure-functions-dotnet-worker.
@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 :)
from azure-functions-dotnet-worker.
@ankitkumarr Thanks for the update. Finally, I was able to run this function locally. However, it still would not run on Azure:
The framework 'Microsoft.NETCore.App', version '5.0.0' was not found
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?
from azure-functions-dotnet-worker.
@dmytro-gokun are you still experiencing issues in Azure? Have you followed the configuration information instructions here?
from azure-functions-dotnet-worker.
@dmytro-gokun hey just following up to see whether you have resolved the issue running the function app on Azure?
from azure-functions-dotnet-worker.
@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.
from azure-functions-dotnet-worker.
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.
from azure-functions-dotnet-worker.
@fabiocav Thanks for the update.
Functions runs on App Service (consumption and dedicated/app service plans).
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?
from azure-functions-dotnet-worker.
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.
from azure-functions-dotnet-worker.
@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.
from azure-functions-dotnet-worker.
I got it working after I found this error. In the past this setting had always been there in the portal, but was missing. I set the AzureWebJobsStorage configuration setting and then it started working.
from azure-functions-dotnet-worker.
@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.
from azure-functions-dotnet-worker.
@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
from azure-functions-dotnet-worker.
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!
from azure-functions-dotnet-worker.
Related Issues (20)
- Logging not working in Azure Function Isolated Model HOT 3
- How to exactly use response compression with the isolated worker model?
- [QUESTION] What is the purpose of the FrameworkReference and ExecutionContext that are supposed to be added to you csproj file when you migrate to using the isolated model?
- Dotnet CLI cannot deploy manual zip packages into a Linux host HOT 1
- IFeatureCollection has been disposed. Object name: 'Collection'. HOT 3
- Using (ITableEntity) POCO class for TableInput on a queue trigger throws a JSON exception, while a TableEntity does work HOT 7
- POCO ITableEntity int stored as Int64 and cannot be read back to same poco HOT 4
- Unable to use Newtonsoft as default serializer HOT 2
- Azure Functions - Logging not working correctly in local HOT 3
- .azurefunctions
- InvalidOperationException: Unable to resolve service for type 'Microsoft.Azure.ServiceBus.Grpc.Settlement+SettlementClient' while attempting to activate 'Microsoft.Azure.Functions.Worker.ServiceBusMessageActionsConverter'
- Function app - Encountered an error (InternalServerError) from host runtime. HOT 2
- Enhance converter exception log to identify the converter
- Implement converter for TimerInfo that does not use customer provided serializers
- TableInput binding fails when using custom POCO
- 'functionCompletionTask' is being set when already complete in Extensions.Http.AspNetCore
- Unexpected TaskCancelledException caused by pre-cancelled CancellationToken HOT 1
- Isolated Azure Function and logs generated by Triggers e.g. Service Bus and/or Event Hubs
- ObjectDisposedException: Request has finished and HttpContext disposed. in Extensions.Http.AspNetCore HOT 2
- Isolated Azure Function - SQL not being tracked inside Application Insights HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-functions-dotnet-worker.