References.
- Migrate apps from Azure Functions version 3.x to version 4.x
- Azure Functions runtime versions overview
- Work with Azure Functions Core Tools
- Durable Functions versions overview
- Extension bundles
- Fix output data serialization format in Node.js functions #2007
Version 3.x of the extension bundle doesn't include the Table Storage bindings, if you require the Table Storage binding, you should continue using the 2.x version.
-
Run the
Functions 4.x Pre-Upgrade Validator
in Azure ➜ Functions App ➜ Diagnose and Solve Problems -
➜ Remove AzureWebJobsDashboard app setting
this is a legacy setting that may have been added when creating older function apps
-
➜ Remove APPINSIGHTS_INSTRUMENTATIONKEY app setting
this gets added by default when you enable Application Insights using the Azure Portal
-
➜ Upgrade local Azure Functions Core Tools to v4
# I'm using homebrew, otherwise you should pick your package manager of choice
# but the same one you originally installed any previous version of the core tools with!!!
brew tap azure/functions
brew install azure-functions-core-tools@4
# if upgrading on a machine that has 2.x or 3.x installed:
brew link --overwrite azure-functions-core-tools@4
- Set NVM default Node to
v16
nvm alias default 16.17.0
- Set
hubName
inhost.json
to<preferred hub name>
ordurablefunctionshub
(this is the default if not supplied)
{
"extensions": {
"durableTask": {
"hubName": "<preferred hub name>",
}
}
}
- Upgrade the extension bundle to v2
Set extensionBundle
to 2.*, 3.0.0 in host.json
This is a minimum requirement for the functions v4 runtime and is also a requirement to use durable entities with durable functions v2.0, so the extension upgrade is a win-win
{
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
}
}
- Change the durable client function binding type from
orchestrationClient
todurableClient
in allfunction.json
files - Change FUNCTIONS_EXTENSION_VERSION to ~4 in
local.settings.json
- Update Dev/Debug webpack build process to also copy the non-functional
package.json
file from thesrc
folder to thedist
folder
- Set the functions app runtime version to v4
See: az functionapp config appsettings set
az functionapp config appsettings set --settings "FUNCTIONS_EXTENSION_VERSION=~4" --resource-group <resource group> --name <functions app name>
- Set the functions app node version to 16
az functionapp config appsettings set --settings "WEBSITE_NODE_DEFAULT_VERSION=~16" --resource-group <resource group> --name <functions app name>
- Set the functions app .NET version to v6.0 -- only for OS type=Windows*
See: az functionapp config set
The default for the v3 runtime is "netFrameworkVersion": "v4.0"
az functionapp config show --resource-group <resource group> --name <functions app name>
az functionapp config set --net-framework-version v6.0 --resource-group <resource group> --name <functions app name>
- Restart the functions app
az functionapp restart --resource-group <resource group> --name <functions app name>
If you visit the functions app in the Azure Portal now you will see the following error in the Overview blade. This is because the extension bundle of the currently deployed project code-base does not meet minimum version requirements for the v4 runtime.
Microsoft.Azure.WebJobs.Script: Referenced bundle Microsoft.Azure.Functions.ExtensionBundle of version 1.8.1 does not meet the required minimum version of 2.6.1 Update your extension bundle reference in host.json to reference 2.6.1 or later
For more information see https://aka.ms/func-min-bundle-versions.
Redeploy your updated codebase.
** If the error persists *****************************************
see this article: https://stackoverflow.com/questions/75991406/how-do-you-solve-azfd0005-azure-function-app-error
******************************************************************
- Remove the node_modules folder and re-install package dependencies
Ensure you've upgraded your Node version to 16, 14 etc
rm node_modules
or
del node_modules
npm install
- Build and deploy the updated project code-base