1
votes

I try to deploy a precompiled Azure Function that use Blob Trigger. After publishing the function, I have the following error in Kudu and my function is not executed:

2017-05-30T14:34:11.436 Starting Host (HostId=sfl-data-forecast-dev-funcs, Version=1.0.10945.0, ProcessId=17328, Debug=True, Attempt=0)
2017-05-30T14:34:11.436 Development settings applied
2017-05-30T14:34:11.436 No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
2017-05-30T14:34:11.436 Job host started
2017-05-30T14:34:11.436 The following 1 functions are in error:
Import: The function type name 'Forecasts.Functions.ImportForecastsFunction' is invalid.

I do not understand why I have this error. The Azure function is in a web project that targeting framework 4.6.1. WebJob SDK, and Extensions nuget package were added. I have downgraded Newtonsoft.Json to version 9.01 but it didn't change anything.

I have the following function.json:

{
  "scriptFile": "..\\bin\\SFL.Data.Forecasts.Functions.dll",
  "entryPoint": "SFL.Data.Forecasts.Functions.ImportForecastsFunction.Run",
  "bindings": [
    {
      "name": "file",
      "type": "blobTrigger",
      "direction": "in",
      "path": "forecasts/{name}",
      "connection": "HotStorageAccount.ConnectionString"
    }
  ],
  "disabled": false
}
4
Can you share the folder structure you have (from the function script root folder, where your host.json file is located)?Fabio Cavalcante

4 Answers

12
votes

Faced the same exception. Turned out that the runtime version was invalid. Erroneously defined as ~1, even though the function is referencing netcore2.1, not supported by runtime Version 1.

In particular, the invalid version was caused by an ARM-template based resource group deployment, defining the function app's parameter FUNCTIONS_EXTENSION_VERSION as ~1 instead of ~2.

0
votes

I solved the problem by providing a namespace for the Azure Function file.

namespace MyProject.AppFunctions

This is my class:

namespace MyProject.AppFunctions
{
    public static class SomeFunction
    {
        public static async Task<HttpResponseMessage> Run(...)
        {
            // CODE
        }
    }
}

This is my functions.json file:

{
  "scriptFile": "..\\bin\\MyProject.AppFunctions.dll",
  "entryPoint": "MyProject.AppFunctions.SomeFunction.Run",
...
}
0
votes

FWIW, I just resolved the same issue. The problem was that in my debugger settings, it was pointing to an old version of the func.exe application. I switched my debugger settings to launch %AppData%\npm\func.cmd instead and everything worked fine.

0
votes

(Solution) Function (FunctionName/CsvUpload) Error: The function type name 'Functions.CsvUpload' is invalid

Error: The function type name 'functionname.CsvUpload' is invalid.

I have solved this error by setting the value in Azure configuration from ~1 to ~2. Make Sure you have to use Visual studio 2019 and Microsoft.NET.Sdk.Functions 3.0.2 When you are working on dotnet core 3.0 something ! If you are using Visual Studio 2017 you must have to set your sdk version lower than 3.0.2 (Microsoft.NET.Sdk.Functions : 1.0.29 something) then only you can set FUNCTIONS_EXTENSION_VERSION = ~1

If you using Visual Studio 2019 then use FUNCTIONS_EXTENSION_VERSION = ~2

If you using Visual Studio 2017 then use FUNCTIONS_EXTENSION_VERSION = ~1