Skip to content
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 Blob trigger throws "hostAccount" : value cannot be null when Function app files are uploaded #1020

Closed
ship2moon opened this issue Dec 2, 2016 · 5 comments

Comments

@ship2moon
Copy link

ship2moon commented Dec 2, 2016

Please provide a succinct description of the issue.

  1. Create a Function App
  2. Upload all files via Kudu API as zip file
  3. Open Function App in browser and ensure all files are uploaded with proper content in each files
  4. When opening C# trigger code (.csx) file in Function App Editor, a floating popup error says:
    "Function ($YourFunctionName) Error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.YourFunctionName'. Microsoft.Azure.WebJobs.Host: Value cannot be null. Parameter name: hostAccount. Session Id: xxxxxxxxxxx

Timestamp: 2016-12-02T18:35:00.083Z""

Expected behavior

The Function App should start triggering with the expected behavior

Actual behavior

  1. Viewing the C# trigger code, displays an error in a floating popup dialog
  2. Function trigger not working

Known workarounds

No workarounds as of now.

Related information

Found the code in this Git fork which throws the error: https://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs.Host/Blobs/Triggers/BlobTriggerBinding.cs#L70

But I don't know where is this getting set.

  • Languages used: C#, PowerShell
  • Source that caused this issue: Actually this is not a issue in source code.
    But here is how my function.json looks like:
    {
    "bindings": [
    {
    "name": "blobParameterInMyFunctionApp",
    "type": "blobTrigger",
    "direction": "in",
    "path": "storageContainerName",
    "connection": "storageAccountName_STORAGE"
    }
    ],
    "disabled": false
    }
@fabiocav
Copy link
Member

fabiocav commented Dec 2, 2016

I just want to confirm, since the SO posts mentions, that you're creating this function app using an ARM template (automation). Is that correct? Or was the app created on the portal?

@ship2moon
Copy link
Author

ship2moon commented Dec 2, 2016

No, I didn't use the ARM template. I used the New-AzureRmResource command with -kind parameter set to "functionapp".
After that I then invoked the Kudu API for the function app and uploaded the function app config json files and .csx files as zip to wwwroot of the site.
This way, my developers can write more code and don't need to fall in the ARM template way, where they have to put huge chunk of C# code in a JSON file with encoding.
Also it lets my developers to write any number of code files and just put them in a folder where my PowerShell script resides. Then my PowerShell script picks the folder, compresses as a zip file and uploads to the Function App using Kudu API.

@fabiocav
Copy link
Member

fabiocav commented Dec 2, 2016

I see.

I've added an answer on SO, but this is being caused by some missing environment settings that are required by the runtime. You can still split those operations, where you use an ARM template to provision the Function App with the settings it needs and use the Kudu API to then push the function if that's a workflow that works better for you.

@ship2moon
Copy link
Author

ship2moon commented Dec 2, 2016

Thanks for the quick turn around.
That's a workaround that I will definitely consider. But my customer doesn't want to go with the ARM template way at all, if there is a provision to go via Azure PowerShell by any means.
Also if in future, I want to create a Http trigger, does it still need a hostAccount?

@ship2moon
Copy link
Author

ship2moon commented Dec 2, 2016

Thanks Fabio! I got to know that irrespective of whatever function that we create, a function app needs a storage account which is mandatory! I am closing this bug, since the rest of this part is about me to figure out, how to specify a storage account while creating a function app using "New-AzureRmResource" command.

@ghost ghost locked as resolved and limited conversation to collaborators Jan 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants