-
Notifications
You must be signed in to change notification settings - Fork 434
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
Microsoft Azure WebJobs SDK 'Storage' connection string is missing or empty #89
Comments
You need to set that value in the appsettings.json file. or through the command |
@lindydonna |
@marcelvandendungen Unfortunately, the error message string comes from the WebJobs SDK (a dependency of Azure Functions), so the message is not helpful. We have a tracking bug to improve this: #38 @ahmelsayed That's a good question--I don't know which direction is the right one. My gut feeling is that our current approach is the right one (appsettings.json is more specific than environment variables), but we should get more feedback. |
@mabdelmonemali Thanks for reporting the error, we're going to also make it so that environment variables take precedence over appsettings.json. See #91 |
Thanks, I've got it working. Yes, environment variables before appsettings.json makes sense. |
@marcelvandendungen Thanks for confirming; there was some discussion in the team about the right order of convention. :) |
There is a requirement for an AzureWebJobsStorage property in the appsettings.json purely for compatibility with the WebJobs SDK, it's not required by the azure function cli, correct? |
@davidsk actually the AzureWebJobsStorage is required when you want to run a Timer triggered Azure Function. You don't need it for the http-triggered Azure Functions indeed. |
And this should be set to the actual value even when developing locally? |
I'm using the Azure Storage Emulator during development.
Works like a charm. |
@davidsk You can use the Azure storage emulator, but it may not work exactly like Azure Storage. As @mkamonster explained, the setting is required for timer triggers, and in fact all triggers aside from HTTP. |
@lindydonna I've got the storage emulator installed now. It's not particularly clear in the docs or blog posts that storage is necessary for timer triggers and easy to confuse the requirement with storage based triggers |
@davidsk Thanks for the feedback, we're going to improve the documentation and CLI error messages around this. See Azure/Azure-Functions#108 and #38 |
@lindydonna Can you eloborate a bit on this statement? Should we prevent testing against the Azure Storage Emulator because of anomalies? |
@mkamonster It's hard to enumerate all the differences, but in general, you should not assume that if something worked correctly with the Storage Emulator, that it will also work correctly in Azure. If you want to use the emulator, then you should do another round of testing with a real storage account before deploying to Azure. |
FYI, this is still pretty confusing. I set the following in my function.json:
At least for local development this made it so I had to specify both variables in appsettings.json: AZURE_STORAGE_CONNECTION_STRING I'll be able to test later if when it goes to the actual app if its smart enough to only use one or the other, or if I really have to specify both. If so, then mine as well stick with the default variable. It is also worth noting that the default appsettings.json has "IsEncrypted": true set, which made it completely ignore my unencypted settings when I added them manually, which kept this error from going away. Once I changed it over to "IsEncrypted" : false, it took my plaintext values and this error went away. |
@securityvoid You can use the value "connection": "AzureWebJobsStorage" if you want the default. AzureWebJobsStorage is required as the runtime creates queues for internal use. |
I've tried everything I can think of w/ |
@jfoshee can you check whether the |
Yes, thanks @ahmelsayed and @securityvoid, the
A minor confusion which persists with the The feeling I'm left with is that the I'm a fan of Azure Functions, which is the reason I persisted this far. So I am very glad you are continuing to improve the tooling. Thanks for listening. Now, back to watching MS Build. ;-) |
@jfoshee Thanks for the detailed feedback. I agree that the error messages are quite confusing! To answer your questions:
You're right that we have a different pattern than web projects, but we're working on making the error messages and help more clear so that customers can learn how we do things. |
@lindydonna I'm encountering the |
@eryon can you verify the |
@ahmelsayed sure, it is |
What about the path you're launching |
I was launching it from the bin\Debug\net461\ directory, as I'm using the VS2017 pre-compiled stuff and that's where all the generated stuff ends up (from the project root, it couldn't detect any functions as |
can you set your |
It's there, and is where I checked first to ensure the normal storage key was in place :) |
hmmmm, then I'm puzzled. I don't really know what could be going wrong. If you do |
@ahmelsayed it does not! See below:
And just to prove the settings file really has content:
|
Maybe it's a file encoding issue? Can you open it in VS code and ensure it has the right encoding and line endings? |
@lindydonna just the |
@eryon Try this: rename your current file to local.settings.json.bak and add a couple of settings manually through the CLI (with encryption off). Then diff the two files. |
@lindydonna when I do that, it generates an Interestingly, when I then run
My function has the following signature: [FunctionName("Spawner")]
public static async Task Run([QueueTrigger("to-render", Connection = "AzureWebJobsStorage")]string item, TraceWriter log) And for what it's worth, this does run from VS2017 Preview 3 without a hitch. It's only having these problems when I try to use the CLI directly. |
huh, what version are you using? the current version is |
@ahmelsayed VS2017 installed beta97, so I assumed that was it, but when I run it in powershell, it's reporting beta91! Is there an easy way to upgrade the CLI used by powershell? |
@ahmelsayed @lindydonna thanks for the support. I uninstalled I also found this article indicating that I can specify the host port in the settings file. I tried that, in order to run it from VS2017, but it's not having any effect... still launches on 7071 when my
Maybe a separate issue? |
yeah, unfortunately VS passes |
@ahmelsayed Is there a github repo I can open a feature request for to stop that? :) |
@eryon yes, this repo :) I think VS should not pass that port number and let the cli or the user decide. But feel free to open an issue on this repo and will discuss it. |
@ahmelsayed Good point about VS, I'll open a bug to track that feature. |
@eryon You can change the port that VS uses by modifying the launch options. Change it to "host start -p 7072" |
I opened this bug for the change to VS: Azure/Azure-Functions#325 |
@lindydonna thanks so much! By launch options, I took you to mean Application arguments in the Project properties > Debug section, and that works just fine :) |
I am running into this same issue when trying to write to TableStorage with the following binding: [Table("Chapter01", Connection = "AzureWebJobsStorage")] IAsyncCollector outputTable Any thoughts? I definitely have the value AzureWebJobsStorage in my appsettings.json file. |
@ssfcultra Please open a new issue as we generally don't monitor closed ones. Can you paste the contents of appsettings.json, eliding any connection strings? Also, note that you should rename your settings file to local.settings.json, as the older name is deprecated. |
Thanks @lindydonna - I have added a new issue here: 204. I have also added an issue for binding to Blob Storage using the Web Jobs bindings syntax. That issue is here: 201. I am including both here since I imagine that once I solve one they both will make sense. Thanks! |
@ahmelsayed, it looks like this issue isn't fixed with dockerized Azure Functions. |
@ConnorMcMahon are you referring to the error message? |
Yes. I think that this issue would have been a better place for me to link that post. |
This has nothing to do with the cli (core tools) the cli doesn't run in the docker container, just the runtime. The runtime outputs this bogus error message. The issue should be on the runtime |
I have a WebJob with some scheduled jobs (using TimerTrigger). I've specified the AzureWebJobsStorage connection string in the connectionStrings.config file
If I add it as an appSetting, it works fine In some other places in my code I use the AzureWebJobsStorage as a connection string and I don't want to add an extra app setting. Is there a way to make this work specifying the value as a connection string and not as app setting? |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm trying out the latest Azure-functions-cli, but cannot seem to get past this issue. When I run 'func function run , the web service window is launched and an error appears:
A ScriptHost error has occurred
Microsoft.Azure.WebJobs.Host: Microsoft Azure WebJobs SDK 'Storage' connection string is missing or empty. The Microsoft Azure Storage account connection string
can be set in the following ways:
, or
I tried both 1 and 2, but neither seems to have any effect.
Azure Functions Cli (1.0.0-beta.93)
Function Runtime Version: 1.0.10774.0
Thanks,
-- Marcel
The text was updated successfully, but these errors were encountered: