Closed priyaananthasankar closed 8 months ago
This doesn't look like a worker issue:
[11/25/18 7:44:04 AM] A host error has occurred
[11/25/18 7:44:04 AM] Microsoft.WindowsAzure.Storage: Settings must be of the form "name=value".
Hi Priya, Are you specifying a valid storage account for your app? This is needed for all triggers except for HTTP. Someone had a similar issue as this, but with a timer trigger: #224.
No I haven't specified a valid connection string. However this has to be mentioned in documentation or such if Webjobs SDK cannot be fixed, because it looks like a bug and the message is not intuitive either.
/cc @ggailey777 for docs feedback
@priyaananthasankar can you please confirm if your app works with the storage setting?
Moving this to host repo for improvements when hitting this issue.
I ran into exactly this issue at a hack night. It was 20 people's first experience with Azure, trying to create a function that ran when a file was updated in blob storage.
Easy to reproduce. Start with func init
, selecting Node.js, then func new
, then func start
:
$ func new
Select a template:
1. Azure Blob Storage trigger
2. Azure Cosmos DB trigger
3. Durable Functions activity
4. Durable Functions HTTP starter
5. Durable Functions orchestrator
6. Azure Event Grid trigger
7. Azure Event Hub trigger
8. HTTP trigger
9. IoT Hub (Event Hub)
10. Azure Queue Storage trigger
11. SendGrid
12. Azure Service Bus Queue trigger
13. Azure Service Bus Topic trigger
14. Timer trigger
Choose option: 6
Azure Event Grid trigger
Function name: [EventGridTrigger]
Writing /Users/adrian/Documents/testfunc/EventGridTrigger/index.js
Writing /Users/adrian/Documents/testfunc/EventGridTrigger/sample.dat
Writing /Users/adrian/Documents/testfunc/EventGridTrigger/function.json
Writing /var/folders/v0/gv8rbbt9157g5599sh8qljpr0000gn/T/tmpG62leW.tmp
info : Adding PackageReference for package 'Microsoft.Azure.WebJobs.Extensions.EventGrid' into project '/Users/adrian/Documents/testfunc/extensions.csproj'.
log : Restoring packages for /Users/adrian/Documents/testfunc/extensions.csproj...
info : Package 'Microsoft.Azure.WebJobs.Extensions.EventGrid' is compatible with all the specified frameworks in project '/Users/adrian/Documents/testfunc/extensions.csproj'.
info : PackageReference for package 'Microsoft.Azure.WebJobs.Extensions.EventGrid' version '2.0.0' added to file '/Users/adrian/Documents/testfunc/extensions.csproj'.
Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restoring packages for /Users/adrian/Documents/testfunc/extensions.csproj...
func Generating MSBuild file /Users/adrian/Documents/testfunc/obj/extensions.csproj.nuget.g.props.
Generating MSBuild file /Users/adrian/Documents/testfunc/obj/extensions.csproj.nuget.g.targets.
Restore completed in 561.8 ms for /Users/adrian/Documents/testfunc/extensions.csproj.
extensions -> /Users/adrian/Documents/testfunc/bin/extensions.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:04.12
The function "EventGridTrigger" was created successfully from the "Azure Event Grid trigger" template.
$ func start
%%%%%%
%%%%%%
@ %%%%%% @
@@ %%%%%% @@
@@@ %%%%%%%%%%% @@@
@@ %%%%%%%%%% @@
@@ %%%% @@
@@ %%% @@
@@ %% @@
%%
%
Azure Functions Core Tools (2.4.419 Commit hash: c9c1724d002bd90b2e6b41393915ea3a26bcf0ce)
Function Runtime Version: 2.0.12332.0
[3/13/19 8:11:38 AM] Starting Rpc Initialization Service.
[3/13/19 8:11:38 AM] Initializing RpcServer
[3/13/19 8:11:38 AM] Building host: startup suppressed:False, configuration suppressed: False
[3/13/19 8:11:38 AM] Reading host configuration file '/Users/adrian/Documents/testfunc/host.json'
[3/13/19 8:11:38 AM] Host configuration file read:
[3/13/19 8:11:38 AM] {
[3/13/19 8:11:38 AM] "version": "2.0"
[3/13/19 8:11:38 AM] }
[3/13/19 8:11:39 AM] A host error has occurred
[3/13/19 8:11:39 AM] Microsoft.WindowsAzure.Storage: Settings must be of the form "name=value".
Settings must be of the form "name=value".
Application is shutting down...
There's no explanation about what could possibly have gone wrong. After 30 minutes of Googling, I gave up on Node.js and tried out C#.
So I did func init
selected C#, func new
, then func start
and I got actual help in the form of the error message:
Missing value for AzureWebJobsStorage in local.settings.json. This is required for all triggers other than HTTP. You can run 'func azure functionapp fetch-app-settings <functionAppName>' or specify a connection string in local.settings.json.
So, running func azure functionapp fetch-app-settings <functionAppName>
solved the problem.
The issue is that the Node.js template created by func init
creates a local.settings.json
file with the following content:
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "node",
"AzureWebJobsStorage": "{AzureWebJobsStorage}"
}
}
The C# template creates the following value. Note that the AzureWebJobsStorage
value is empty, therefore triggering the error message.
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}
So, the fix is just to remove {AzureWebJobsStorage}
from the local.settings.json
file. I searched through the https://github.com/Azure/azure-functions-templates/tree/dev/Functions.Templates/ProjectTemplate repo, but could only find C# and F# templates, I also searched through https://github.com/Azure/azure-functions-host but couldn't find any reference there, or I'd submit a PR.
It is not work for me if i remove {AzureWebJobsStorage}
from the local.settings.json
file. However, if i insert my blob storage's connection string which i have created for Azure Function in Azure. I can successfully run func host start
Here is my local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=xxxxxxx",
"FUNCTIONS_WORKER_RUNTIME": "python"
}
}
It is not work for me if i remove
{AzureWebJobsStorage}
from thelocal.settings.json
file. However, if i insert my blob storage's connection string which i have created for Azure Function in Azure. I can successfully runfunc host start
Here is my
local.settings.json
{ "IsEncrypted": false, "Values": { "AzureWebJobsStorage": "DefaultEndpointsProtocol=xxxxxxx", "FUNCTIONS_WORKER_RUNTIME": "python" } }
I was managed to make it work at this point, but now I got:
Could not load file or assembly 'SendGrid, Version=9.8.0.0,
Any clues?
Closing as stale - create new issues with recent/relevant context if needed.
Event Grid Trigger does not work, crashes when
func host start
command is issued:Logs:
Azure Functions Core Tools (2.0.3) Function Runtime Version: 2.0.12115.0 : Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0] User profile is available. Using '/Users/prananth/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest. info: Host.General[0] Building host: startup suppressed:False, configuration suppressed: False info: Host.Startup[0] Reading host configuration file '/Users/prananth/OneWeek-Table30/TestProj/host.json' info: Host.Startup[0] Host configuration file read: { "version": "2.0" } [11/25/18 7:44:04 AM] A host error has occurred [11/25/18 7:44:04 AM] Microsoft.WindowsAzure.Storage: Settings must be of the form "name=value". Listening on http://0.0.0.0:7071/ Hit CTRL-C to exit... Settings must be of the form "name=value". Application is shutting down... info: Host.General[0] Initialization cancellation requested by runtime. crit: Microsoft.AspNetCore.Hosting.Internal.HostedServiceExecutor[9] An error occurred starting the application System.AggregateException: One or more errors occurred. (The operation was canceled.) ---> System.OperationCanceledException: The operation was canceled. at System.Threading.CancellationToken.ThrowOperationCanceledException() at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.<>cDisplayClass29_0.b1(Task t) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs:line 207
at System.Threading.Tasks.ContinuationResultTaskFromTaskb 1(Task t) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs:line 207
at System.Threading.Tasks.ContinuationResultTaskFromTask
1.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot) --- End of stack trace from previous location where exception was thrown --- at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.StartHostAsync(CancellationToken cancellationToken, Int32 attemptCount, JobHostStartupMode startupMode) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs:line 204 at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.StartAsync(CancellationToken cancellationToken) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs:line 100 at Microsoft.AspNetCore.Hosting.Internal.HostedServiceExecutor.ExecuteAsync(Func
2 callback) --- End of inner exception stack trace --- at Microsoft.AspNetCore.Hosting.Internal.HostedServiceExecutor.ExecuteAsync(Func`2 callback) at Microsoft.AspNetCore.Hosting.Internal.HostedServiceExecutor.StartAsync(CancellationToken token) ---> (Inner Exception #0) System.OperationCanceledException: The operation was canceled. at System.Threading.CancellationToken.ThrowOperationCanceledException() at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.<>cDisplayClass29_0.1.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot) --- End of stack trace from previous location where exception was thrown --- at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.StartHostAsync(CancellationToken cancellationToken, Int32 attemptCount, JobHostStartupMode startupMode) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs:line 204 at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.StartAsync(CancellationToken cancellationToken) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs:line 100 at Microsoft.AspNetCore.Hosting.Internal.HostedServiceExecutor.ExecuteAsync(Func
2 callback)<---Hosting environment: Production Content root path: /Users/prananth/OneWeek-Table30/TestProj Now listening on: http://0.0.0.0:7071 Application started. Press Ctrl+C to shut down. info: Host.General[0] Stopping host... info: Host.General[0]