Search code examples
azurevisual-studio-codeazure-devopsazure-functions

VSCode Azure Functions - Error: Cannot read properties of undefined (reading 'createClient')


I'm unable to upload the code to azure functions for some reason. It was working few days ago when I tried.

Now I get the below error. Here is a screenshot of the error.

enter image description here

4:27:59 PM: Error: Cannot read properties of undefined (reading 'createClient')
4:28:03 PM: Error: Cannot read properties of undefined (reading 'createClient')
4:31:28 PM: Error: Cannot read properties of undefined (reading 'createClient')

Only thing I modified this time is the local.settings.json as below.

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "AzureWebJobsStorage": "##########",
    "CosmosDBConnection": "##########",
    "StorageConnectionString": "#########"
  }
}

tried the old version of the code which used to work and there were no modification but now that also reports the same error.

Any idea what the issue is? I'm guessing something wrong with vscode.

Here is my local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "AzureWebJobsStorage": "#############",
    "CosmosDBConnection": "#############",
    "StorageConnectionString": "#############"
  }
}

Here is the .vscode\settings.json

{
  "azureFunctions.deploySubpath": "bin/Release/netcoreapp3.1/publish",
  "azureFunctions.projectLanguage": "C#",
  "azureFunctions.projectRuntime": "~3",
  "debug.internalConsoleOptions": "neverOpen",
  "azureFunctions.preDeployTask": "publish (functions)"
}

Update: Uploading from resource view works but uploading from workspace doesn't work. Here is a reference to the bug reported and the work around.


Solution

  • Figured it out.

    Delete or move the .vscode folder from the project folder and restart the Visual studio code and it'll initialize the function app again. Now you can upload the function without any issues.