-
Notifications
You must be signed in to change notification settings - Fork 34
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
Azure Function v2 Autocomplete Not Working #34
Comments
This is the message I'm seeing after the function completes (note this is happening after the function has finished executing): |
Update - I have created a brand new project with a very simple function app and the issue does not occur there. It seems to be something related to my specific project setup. |
Update 2 - I have added a very basic Startup.cs to my very simple project and it fails again. Here is Startup.cs:
I have also added this Nuget package: Microsoft.Azure.Functions.Extensions, v1.0.0 Commenting out Startup.cs makes the problem go away, so it seems to be related to Startup.cs. |
Here is the Azure function I have created for testing:
|
Function runtime already provided After you added new
|
Thank you for showing me what I was doing wrong. So it turns out this line is not needed: |
If you want to keep your custom configuration, you can pull the IConfiguration from the DI and add it to your custom configuration. Then re-register your new configuration using DI. The autocomplete will be respected and you can keep your custom providers such as key vault. ***Edit: Keeping the above for history and context. For better solutions see the comments later in the thread: |
Thanks @Bubba95x! Your suggestion worked like a charm. Now we have both |
For anyone checking on adding custom config You can override the
|
Yes! @hybridtechie is absolutely correct. We ran across this information when speaking to someone at Azure Support. This is all detailed in the link they provided, but the general rule of thumb is use ConfigureAppConfiguration for app configuration and Configure for registering services. Our start up files these days look something like this:
|
@NoPanicBanick how do you add host.json configuration in this way? Is it also to be added under ConfigureAppConfiguration? |
@hybridtechie where does that AddAzureAppConfiguration come from? I've added Microsoft.Extensions.Configuration 3.1.17 but I could not find it. |
@NoPanicBanick same question as @meyunus |
Checkout this link. That extension method is for registering an Azure Configuration Service in your application. Not to be confused with the App Settings located on your Azure Function's configuration. App Settings should be automatically registered by the Azure Function SDK. Similarly, the host.json registration should be handled by the Azure Function SDK. You don't have to manually register it. If you want to verify this; build the config in the startup, set a break point, and check the providers in the built config. You should see a provider that contains your host.json configuration. |
@NoPanicBanick I am using v3 and I finally ended up using a mixed version of your above solution, but via override of ConfigureAppConfiguration. Something like this:
And there is NO need to do sth like this |
I have configured my host.json as follows:
However, when I run my service bus triggered Azure function, the host log says the following:
[2019-10-11 4:48:27 PM] ServiceBusOptions
[2019-10-11 4:48:27 PM] {
[2019-10-11 4:48:27 PM] "PrefetchCount": 0,
[2019-10-11 4:48:27 PM] "MessageHandlerOptions": {
[2019-10-11 4:48:27 PM] "AutoComplete": true,
[2019-10-11 4:48:27 PM] "MaxAutoRenewDuration": "00:05:00",
[2019-10-11 4:48:27 PM] "MaxConcurrentCalls": 16
[2019-10-11 4:48:27 PM] },
[2019-10-11 4:48:27 PM] "SessionHandlerOptions": {
[2019-10-11 4:48:27 PM] "AutoComplete": true,
[2019-10-11 4:48:27 PM] "MaxAutoRenewDuration": "00:05:00",
[2019-10-11 4:48:27 PM] "MaxConcurrentSessions": 2000,
[2019-10-11 4:48:27 PM] "MessageWaitTimeout": "00:01:00"
[2019-10-11 4:48:27 PM] }
[2019-10-11 4:48:27 PM] }
When I do messageReceiver.DeadLetterAsync in my Azure function, there is an error message afterward saying the lock is invalid (it is trying to complete the message again).
From the log, also these are the versions I am using:
Azure Functions Core Tools (2.7.1704 Commit hash: fbab3b9c1de5ab95e3b4b6a471ead62c4f37e89c)
Function Runtime Version: 2.0.12742.0
[2019-10-11 4:48:16 PM] Building host: startup suppressed:False, configuration suppressed: False
[2019-10-11 4:48:16 PM] Loading startup extension 'Startup'
[2019-10-11 4:48:16 PM] Loaded extension 'Startup' (1.0.0.0)
[2019-10-11 4:48:16 PM] Loading startup extension 'ServiceBus'
[2019-10-11 4:48:16 PM] Loaded extension 'ServiceBus' (3.1.1.0)
I have a Startup.cs also, if it makes a difference.
The text was updated successfully, but these errors were encountered: