DataBach
DataBach

Reputation: 1645

How to fix 'launch.json' error when debugging Azure Function locally using Azurite?

I am currently developing a small time-triggered Azure Function App to retrieve files from a SFTP Server. To debug the code I am using the azurite storage emulator. The set up and running of the emulator worked well. However, I receive a Visual Studio Code error saying that the program can not be launched and the code does not compile (see image below). I am using the default launch.json that was provided via the Azure extension:

{
"version": "0.2.0",
"configurations": [
  {
  "name": "Attach to Python Functions",
  "type": "python",
  "request": "attach",
  "preLaunchTask": "func: host start"
 }
]
}

The error is only received as a pop-up. Please have a look at the following picture to see the error and terminal output:

Error

The error says: "request":"attach" requires either "connect", "listen", or "processid". I tried multiple options on how to make it work including launch.json as described here. The error will go away, but the program will simply not run.

Do you have suggestions or a tutorial on how to fix this ?

Note that I use python 3.8 and Azure Functions version 4.0

Upvotes: 3

Views: 2476

Answers (1)

DataBach
DataBach

Reputation: 1645

Ok, what helped in the end was to:

  1. delete the .vscode directory of your project
  2. close VS Code and then re-open VS Code
  3. rebuild the .vscode directory (you should be prompted to do so)

Upvotes: 3

Related Questions