Azure-Functions icon indicating copy to clipboard operation
Azure-Functions copied to clipboard

misleading warning message (local.host.settings) : Skipping 'xxx' from local settings as it's already defined in current environment variables

Open hamdyghanem opened this issue 6 years ago • 10 comments

I have a setting value in local.host.settings which has an empty string value: "xxx":""

Once I start the function I will get an : Skipping 'xxx' from local settings as it's already defined in current environment variables

which is misleading

hamdyghanem avatar Mar 18 '19 18:03 hamdyghanem

I am not sure what part of the message you are referring to as misleading. The message basically mentions that the function runtime is going to use the value of the setting from the environment variables instead of the one defined in your local settings. Can you elaborate a bit more on what is misleading?

soninaren avatar Mar 19 '19 01:03 soninaren

Is this value exist in the environment variable? that is confusion! the message should give more details indication that local settings is missing a real value. Other note: what is wrong with putting a setting's value as an empty string?

hamdyghanem avatar Mar 19 '19 11:03 hamdyghanem

  • You would get this warning when there is a setting xxx present in local.settings.json. The same setting xxx is present on your computer as an environment variable. So when you start functions CLI it sees that it can get the value for xxx from 2 places. The message simply states that it is going to use the value of the setting from your computer's environment variable.
  • The actual value of xxx in local.settings.json or you computers environment variable has no effect on the cause of this warning. You would get this warning even if xxx had an actual value in the local.settings.json file and is not an empty string.
  • Adding a warning that a property in local.setting.json is missing a value could be noisy since the property may not be used by any of the function app or may be empty on purpose as you suggested.
  • There is nothing wrong with having empty value for a setting. The message does not have co-relation to the empty value in the local.settings.json.

Hope this provides some clarity to the cause of warning message. However i am open to suggestions for a clearer message. Do you have a recommendation?

soninaren avatar Mar 20 '19 23:03 soninaren

@soninaren You get this warning when the setting in local.settings.json is empty and the environment variable does not exist. This means you can't rely on empty strings in local.settings.json as the result will be null. I believe this is a bug, or at least you should change the warning message to say that empty settings will be ignored/return null.

JontyMC avatar Mar 27 '19 11:03 JontyMC

You also get this warning when a variable is NOT set in my computer's environment, NOT set in my local.settings.json (not even to an empty string) but ONLY set in my launchSettings.json. In my case I get warnings on the AZURE_FUNCTIONS_ENVIRONMENT variable. I thought that this was maybe due to the fact that it defaults to the value "Development", but I get the same warning when I set it to "Staging" in my launchSettings.json. In that case I have no idea which value is used. That is confusing to say the least.

mountain65 avatar Nov 18 '20 08:11 mountain65

When I set a breakpoint in my FunctionsStartup.Configure(IFunctionsHostBuilder) override I can see that I actually get the "Staging" value in my environment. So it gets picked-up properly.

mountain65 avatar Nov 18 '20 08:11 mountain65

Getting the same warning even though I don't have AZURE_FUNCTIONS_ENVIRONMENT variable in local.settings.json, can anyone explain how is that possible? image image image

the-rule avatar Nov 24 '23 15:11 the-rule

How do I know which Env Var is already set? I ran into the same warning.

FakieHeelflip avatar Sep 09 '24 12:09 FakieHeelflip

I have a similar issue, and besides that builder.Environment.EnvironmentName for some reason is not populated with AZURE_FUNCTIONS_ENVIRONMENT value (and always returns "Production")

randomkms avatar Feb 10 '25 09:02 randomkms

any help please about that: Skipping 'FUNCTIONS_WORKER_RUNTIME' from local settings as it's already defined in current environment variables. [2025-02-21T21:50:56.607Z] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.). For detailed output, run func with --verbose flag. [2025-02-21T21:51:01.323Z] Host lock lease acquired by instance ID '00000000000000000000000055B935A2'.

MohammedYassineBen avatar Feb 21 '25 22:02 MohammedYassineBen