-
Notifications
You must be signed in to change notification settings - Fork 358
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
Templated QueueTrigger name fails to resolve in 3.0.3. #2063
Comments
Seems this is undocumented. I was able to fix it by adding a singleton service: let configNameResolver =
{ new INameResolver with
member __.Resolve(name) =
ConfigurationManager.AppSettings.[name] }
[<EntryPoint>]
let main argv =
let builder =
HostBuilder()...
.ConfigureServices(fun services ->
// This seems to correctly add the name resolver for the QueueTrigger
services.AddSingleton(configNameResolver) |> ignore
)
// rest of configuration
use host = builder.Build()
host.Run()
0 |
Hi, I have the same error. @panesofglass could you give more details about your fix, I dont know how to implement it, it does not seem to be C#. Thanks :) |
@ranouf, the above is F#. For C#, the following should work: class ConfigNameResolver : INameResolver
{
public string Resolve(string name)
{
return ConfigurationManager.AppSettings[name];
}
}
class Program
{
public static void Main(string[] args)
{
var configNameResolver = new ConfigNameResolver();
var builder =
new HostBuilder()
.ConfigureServices(services =>
// This seems to correctly add the name resolver for the QueueTrigger
services.AddSingleton(configNameResolver);
);
using (var host = builder.Build())
{
host.Run();
}
}
} |
Thanks, it works! |
Thanks @panesofglass I can confirm that I have this same issue when trying to run Azure Durable Function in Linux Container and I had to do the same workaround. |
We faced the same issue. We tried to publish the azure function app from Visual Studio 2019 version 16.9.4 and we discovered that the application setting that we configured in the "Manage Azure app service settings" were ignored if the setting was "classname:propertyname" (example "Idp:Cloud") |
Hello.
The INameResolver does not passing (null instead) to the constructor. |
Defining a
[QueueTrigger("%InputQueue%")]
fails to resolve theInputQueue
from theApp.config
appSettings
.Repro steps
Provide the steps required to reproduce the problem
Add an
App.config
setting inappSettings
forInputQueue
, e.g.<add key="InputQueue" value="queue" />
Set the
QueueTriggerAttribute
to use the templated value, e.g.[QueueTrigger("%InputQueue%")]
Expected behavior
Prior to 3.0.*, the queue trigger would pick up the queue name from the
App.config
appSettings
.Actual behavior
Runtime exception:
Known workarounds
None.
Related information
The text was updated successfully, but these errors were encountered: