microsoft / vscode-azurefunctions

Azure Functions extension for VS Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions
MIT License
291 stars 133 forks source link

An error occurs when deleting a function of Node V4 Programming Model (Preview) #3615

Open v-ruizh opened 1 year ago

v-ruizh commented 1 year ago

OS: All Build Version: 20230304.7 Regression: Not a Regression

Repro Steps:

  1. Create a JavaScript project with Httptrigger function of Node V4 Programming Model (Preview).
  2. Deploy this project to one Linux Node Function App.
  3. Click "Upload settings" button in the below notification after deployment. image
  4. Refresh the "Azure" view.
  5. Expand the above Function App and delete the function.
  6. Check whether succeeds to delete the function or not.

Expect: Succeed to delete the function without any error.

Actual: An error occurs. image

More Info:

  1. This issue does not reproduce when deleting a function of Node V3 model.
  2. This issue also reproduces on the latest released Functions extension v1.10.3.
MicroFish91 commented 1 year ago

If you try deleting a couple minutes after uploading the settings does this issue still repro? Wondering if there is a timing issue

v-ruizh commented 1 year ago

Verified this issue on the latest build 20230309.12, there is no error when deleting the function from VS Code. (The deleted function reappears after several seconds 3614) image

But the "Delete" button is disabled on the portal, there is a warning "Your app is currently in read only mode...". image

alexweininger commented 1 year ago

This should be fixed once the programming model is out of preview.

MicroFish91 commented 1 year ago

Does this still reproduce?

ejizba commented 1 year ago

I would say y'all should just remove the "delete function" action for the new model. The file structure is so much more flexible/random that we would never be able to reliably delete just one function from a user's app. In the old model it was easy because it had to be one folder per function and as long as you deleted the function.json file it didn't even matter if you deleted the js/ts code.

alexweininger commented 1 year ago

I would say y'all should just remove the "delete function" action for the new model. The file structure is so much more flexible/random that we would never be able to reliably delete just one function from a user's app. In the old model it was easy because it had to be one folder per function and as long as you deleted the function.json file it didn't even matter if you deleted the js/ts code.

Just to clarify, are you suggesting that apps using the new model won't support the delete function operation that is available on the API/SDK?

Asking because in your comment it makes it seem like the extension is deleting local project files. I'm pretty sure we don't do that but I didn't look that hard. 😄

ejizba commented 1 year ago

Just to clarify, are you suggesting that apps using the new model won't support the delete function operation that is available on the API/SDK?

Yes. I'm not in charge of that API and I don't know who is, but I don't see how it would work.

Asking because in your comment it makes it seem like the extension is deleting local project files. I'm pretty sure we don't do that but I didn't look that hard.

Well this is for deleting a remote function, right? I don't think you're manually deleting any remote files, I think you're just calling the API. But I think the API is deleting remote files.

At the end of the day, this feature had limited value anyways. It would be better for the user to manually delete the function in their app and re-deploy instead of trying to use this API to edit their app in production.