I am attempting to run an Azure Function (JavaScript) locally, but it's failing upon func start
with the following error.
AddConfig: The binding type(s) 'table' are not registered. Please ensure the type is correct and the binding extension is installed.
Please note that I have successfully installed the prerequisites, which at the time or writing were .NET Core 2.1, Node.JS and the Core Tools package.
As is obvious from the error above, I've added an output binding for a Table to function.json for a function called 'AddConfig'. I added the binding as per the documentation.
Is anyone able to advise on what I may be missing here?
Things I've tried
Following the documentation
I ran the following command in the project folder, as per the documentation.
func extensions install
This produced the following output -
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restoring packages for C:\super-secret-path\WitchHunt\AddConfig\extensions.csproj...
Generating MSBuild file C:\super-secret-path\WitchHunt\AddConfig\obj\extensions.csproj.nuget.g.props.
Generating MSBuild file C:\super-secret-path\WitchHunt\AddConfig\obj\extensions.csproj.nuget.g.targets.
Restore completed in 314.99 ms for C:\super-secret-path\WitchHunt\AddConfig\extensions.csproj.
extensions -> C:\super-secret-path\WitchHunt\AddConfig\bin\extensions.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.66
The command also resulted in extensions.csproj
being added to the project with the following content -
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<WarningsAsErrors></WarningsAsErrors>
<DefaultItemExcludes>**</DefaultItemExcludes>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator" Version="1.0.1" />
</ItemGroup>
</Project>
Targeting the required extension
I have tried to install the extension manually using the following command. While this action worked and resulted in the package reference being added to extensions.csproj, rerunning the function results in the same error.
func extensions install --package Microsoft.Azure.WebJobs.Extensions.Storage --version 3.0.3
Creating a binding on the Portal and copying 'extensions.csproj'
The title says it all really. I created a Function App, added a function, created a binding, installed the extension and then copied/pasted extensions.csproj, but the error still persists.
My function.json
, in case anyone is interested
The httpTrigger
and http
bindings are those which were generated when I created the function, while the table
binding was copied from the documentation (I've then altered the tableName
and connection
properties, but I don't think that's the issue).
{
"disabled": false,
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "res"
},
{
"tableName": "WitchHuntConfig",
"connection": "AzureWebJobsStorage",
"name": "tableBinding",
"type": "table",
"direction": "out"
}
]
}
func extensions install --package Microsoft.Azure.WebJobs.Extensions.Storage --version 3.0.3
this command should fix and my function works fine. Could you deletebin obj
folder andextensions.csproj
file then run this command again? – Jerry Liuobj
folder seems to have done the trick. I did however still have to target the storage package, which is not what the documentation suggests. Hopefully MS will make their documentation accurate in the near future. – David Gard