I had initially a 1st gen cloud function deployed but i wanted to upgrade it to 2nd gen. I tried to deploy a 2nd gen cloud function but then i wanted to go back to 1st gen again, and then i tried to deploy a 1st gen cloud function, which gave me this error
ERROR: (gcloud.functions.deploy) ResponseError: status=[400], code=[Ok], message=[Failed to create function, function function_name already exists under 2nd gen environment. Please delete conflicting function first or deploy the function with a different name.]
However, the 2nd gen cloud function does not appear on the list with all the other cloud functions.
Additionally, i tried to delete the cloud function using the command
gcloud functions delete function_name --gen2 --region=region , but it says that the cloud function does not exist.