Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot deploy -- "Internal error: Expected value to be neither null nor undefined: resourceTypeData" #3620

Open
loomlike opened this issue Mar 8, 2023 · 47 comments
Assignees
Labels

Comments

@loomlike
Copy link

loomlike commented Mar 8, 2023

When deploy to Azure, it throws the error:

Steps:

  1. Create a local project on WSL and setup the simple http trigger project
  2. Select Create Function App in Azure -> select the subscription -> type in the function-name -> select the python version -> error.

Envs:

  • OS: Windows VSCode connecting to WSL Ubuntu 20.04
  • Python: 3.8
  • VSCode: 1.76.0
  • Azure function extension: 1.10.3
@MicroFish91
Copy link
Contributor

Does this only reproduce when you're running WSL Ubuntu?

@loomlike
Copy link
Author

No, I just tested and confirmed it happens on VSCode ssh into DSVM host too.

@alexweininger
Copy link
Member

Are you trying to create the Function app in a special Azure environment like a sovereign cloud or Arc?

@jiazhongchen
Copy link

jiazhongchen commented Mar 27, 2023

I am also seeing this error following: https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-powershell#configure-your-environment

It happens soon after I choose the language, in my case it's powershell.

OS: Windows with VSCode
Powershell: 7.2
AzFunctions: 1.10.4

@mumurug-MSFT
Copy link

I am also facing the same issue when I try to create a Function app from VS code (1.77.1) with runtime Node.js 18 LTS for Azure Functions v1.10.4.

image

@alexweininger
Copy link
Member

Have you been able to create Function Apps previously? The error is happening here. Seems like something is wrong with the providers.

@mumurug-MSFT
Copy link

I have created Func Apps before but not for Typescript. First time, testing out Typeescript apps.

@alexweininger
Copy link
Member

alexweininger commented Apr 6, 2023

When creating a Function App, we lookup the following resource types on these providers:

  1. the storageAccounts resourceType on the Microsoft.Storage provider.
  2. the resourceGroup resourceType on the Microsoft.Resources provider.

I'm not sure in what scenarios these providers don't include those resources types.

Could you try making the request using the "Try it" feature on the Azure REST API documentation?

https://learn.microsoft.com/en-us/rest/api/resources/providers/get?tabs=HTTP#code-try-0

Make sure to select the same subscription you were using in the extension, and fill in the resourceProviderNamespace input with Microsoft.Storage or Microsoft.Resources.
image

Once you make the request, verify that the storageAccounts resource type is in the response. It should look like this:
image

Please do the same verification for the resourceGroup resourceType on the Microsoft.Resources provider.

@alexweininger
Copy link
Member

alexweininger commented Apr 6, 2023

Follow up: you can also follow this guide for how to check which resource providers you have registered, and which resource types they support. This might be easier than using the Try It feature. 😄

https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-providers-and-types#microsoftstorage

edit:
You can also just run these Azure CLI commands

  1. az provider show --namespace Microsoft.Storage --query "resourceTypes[*].resourceType" --out table
  2. az provider show --namespace Microsoft.Resources --query "resourceTypes[*].resourceType" --out table

If you could run these commands and share the output, or just verify that the expected resource types are there, that would help a lot!


Note: it seems like the results can vary depending on api version. Might be caused by that.

@alexweininger alexweininger added info-needed See https://aka.ms/azcodeissuereporting bug and removed info-needed See https://aka.ms/azcodeissuereporting labels Apr 6, 2023
@alexweininger
Copy link
Member

Update: Plenty of Microsoft users are running into this issue, however, I haven't seen an external customer report this.

The issue is caused by a bug in the ARM service where the Microsoft.Resources resource provider is registered, but there are not resource types for the Microsoft.Resources provider. The current workaround is to re-register the Microsoft.Resources provider manually.

See this IcM for more details https://portal.microsofticm.com/imp/v3/incidents/details/381037873

@loomlike
Copy link
Author

loomlike commented Jun 6, 2023

az provider show --namespace Microsoft.Resources --query "resourceTypes[*].resourceType" --out table
returns nothing on my laptop (WSL). What's the resolution?

@alexweininger
Copy link
Member

az provider show --namespace Microsoft.Resources --query "resourceTypes[*].resourceType" --out table returns nothing on my laptop (WSL). What's the resolution?

@loomlike sorry I missed this reply, are you still experiencing this issue? If so, I think your subscription needs to be mended by the ARM team.

@mikekistler
Copy link
Member

I just hit this problem today trying to deploy a function app from VSCode on MacOS.

Pasted Graphic 4

I tried issuing

az provider show --namespace Microsoft.Resources --query "resourceTypes[*].resourceType" --out table

and it returns ~40 results.

This is using a Microsoft account. I switched to using another account and did not hit this issue.

@alexweininger
Copy link
Member

alexweininger commented Aug 8, 2023

@mikekistler

and it returns ~40 results.

Is "resourceGroups" included in these results? I'm assuming no since the extension doesn't think so 😢

This is using a Microsoft account. I switched to using another account and did not hit this issue.

Thanks for that info, this is an Microsoft account issue. You'll need to unregister and reregister the RP to fix it.

az provider unregister --namespace Microsoft.Resources
az provider register --namespace Microsoft.Resources

@mikekistler
Copy link
Member

Is "resourceGroups" included in these results?

Yes it is.

>az provider show --namespace Microsoft.Resources --query "resourceTypes[*].resourceType" --out table | grep -i resourcegroups
resourceGroups
subscriptions/resourceGroups
subscriptions/resourcegroups/resources

@alexweininger
Copy link
Member

Can you make sure that you're signed in with the same account in the extension and on the CLI.

@mikekistler
Copy link
Member

It is the same account. I just signed out and signed back in and problem still exists.

@mikekistler
Copy link
Member

Update! It just occurred to me that I should specify the specific subscriptionId on the az provider show command, because I apparently have access to several. When I do that I get no entries back. So the register/unregister is likely what I need. Thank you.

@alexweininger
Copy link
Member

Update! It just occurred to me that I should specify the specific subscriptionId on the az provider show command, because I apparently have access to several. When I do that I get no entries back. So the register/unregister is likely what I need. Thank you.

Ok, that makes a lot more sense. Thanks for the update. Let me know if reregistering the RP works for you.

@thena-seer-sfg
Copy link

Having the same problem, but I'm getting this error when trying to de-register the RP: the resource namespace "microsoft.resources" is invalid

Screenshot 2023-11-14 at 11 11 40 AM

@alexweininger
Copy link
Member

Having the same problem, but I'm getting this error when trying to de-register the RP: the resource namespace "microsoft.resources" is invalid

Screenshot 2023-11-14 at 11 11 40 AM

That error is happening on the portal? If yes, please file a support ticket on Azure and they will be able to fix the issue.

@Zixer1
Copy link

Zixer1 commented Jan 25, 2024

Not sure how relevant it is since the issue was quite some time ago, and closed, however i noticed i had the same error.
Make sure that when you open your workspace folder, that you open the overarching project folder and not only the sub folder that contains the actual code, you know if you are in the right folder if you have the local.settings.json and requirements.txt files in the folder

@tyler-suard-parker
Copy link

It's 2024 and I am still having this problem.

@aa-bharath
Copy link

aa-bharath commented Aug 13, 2024

"Internal error: Expected value to be neither null nor undefined: id"
I am having this issue as well. I have uninstalled and reinstalled VS Code and its Extensions 10+ times and still on the same error. I have tried updating all the npm packages. It is very frustrating and this was working fine a month back earlier. Not sure what changed in last 1 month. Unable to deploy even a simple hello world apps to Web App. I start getting these error when I am trying to deploy (selecting the Azure subscription --> Listing the Resource groups and then this error) . I see same errors under 13-Azure App Service.log under C:\Users<userid>\AppData\Roaming\Code\logs\20240813T121629\window1\exthost\output_logging_20240813T121631

@ManiKarthik-v
Copy link

Facing the same problem when deploying the existing azure function.

Internal error: Expected value to be neither null nor undefined: newSiteName

@alexweininger
Copy link
Member

Facing the same problem when deploying the existing azure function.

Internal error: Expected value to be neither null nor undefined: newSiteName

Hi @ManiKarthik-v, that is actually a separate issue. Could you open a new issue and include repro steps?

@e14mattc
Copy link

Facing the same problem when deploying the existing azure function.

Internal error: Expected value to be neither null nor undefined: newSiteName

I was getting the same issue; ended up changing the configuration of the FA in Azure to set 'SCM Basic Auth Publishing Credentials' = On. Then I was able to deploy from VS Code by using this command in the terminal;

func azure functionapp publish nameofmyfunctionappinazure --build remote

@mehdy-dev
Copy link

mehdy-dev commented Dec 30, 2024

i faced same issue when using the deploy from menu -> "Internal error: Expected value to be neither null nor undefined: newSiteName"
resolution -> use this command from powershell terminal and it worked well.

func azure functionapp publish <FunctionAppName>

i use azure functions "Version 1.16.1"
also .net 8 lts.

@alexweininger
Copy link
Member

i faced same issue when using the deploy from menu

Can you share a screenshot or specify what menu you are using to deploy?

@mehdy-dev
Copy link

mehdy-dev commented Dec 31, 2024

i faced same issue when using the deploy from menu

Can you share a screenshot or specify what menu you are using to deploy?

Image

after that it will pop 2 options as a target deploy -> i tried both and same error
1- existing function app
2- create new function app

@Balthazaar
Copy link

Balthazaar commented Dec 31, 2024

Facing the same
Internal error: Expected value to be neither null nor undefined: newSiteName

With an existing function app, I deployed countless times through VS Code in the past. It looks like something recently changed in Azure.

This is the menu i'm using to deploy

Image

This worked for me for months if not years until today

@chintankotadia
Copy link

I am facing the same issue as @Balthazaar. It was working perfectly fine until yesterday.

@aggerritsen
Copy link

I have the same issue, worked fine a couple of days ago. I need this urgently...
Please provide any feedback as possible

@gasiorowskir
Copy link

gasiorowskir commented Dec 31, 2024

Same here, was able to deploy the code to Function App yesterday now it fails with message:
Image

I have not updated anything on VSCode side, used this version of the plugin for last weeks intensively:
Image

@alexweininger
Copy link
Member

alexweininger commented Dec 31, 2024

Until we release a fix for this issue the workaround is to revert the Azure Resources extension from v0.10.0 to v0.9.9.

You can do that by using "Install specific version..." shown in the screenshot below.
Image

Edit: I've found a better fix! See #3620 (comment)

@NawinSiddu
Copy link

downgrading Azure Resources Extension from 0.10.0 to 0.9.0 worked for me.

@gasiorowskir
Copy link

Thanks @alexweininger, downgrading Azure Resources to 0.9.9 worked for me, I was able to deploy my Function App.

@alexweininger
Copy link
Member

Does the error occur right after selecting a Function app to deploy to? Or does it happen during the deploy process?

@alexweininger
Copy link
Member

I was finally able to reproduce the issue. Turns out it only reproduces on VS Code - Stable, and not VS Code - Insiders. So that's another workaround.

@alexweininger
Copy link
Member

Looks like there's been a significant resurgence of this issue recently

Well it's actually a new issue compared to the original post but all the conversation has happened here 🤷

@alexweininger
Copy link
Member

The fix for this issue is to change the Microsoft Authentication Implementation setting to MSAL Image
This is the default setting in the current insiders version.

@Hanif-A
Copy link

Hanif-A commented Dec 31, 2024

Thanks @alexweininger, working on VSCode 1.96.0 with Az Resources 0.99.

@alexweininger
Copy link
Member

I have a fix in the works. Hoping to release the full fix today. microsoft/vscode-azureresourcegroups#1000

@Balthazaar
Copy link

downgrading Azure Resources Extension worked for me too!

@rpannell
Copy link

Ditto, after I restarted once I downgraded.

@alexweininger
Copy link
Member

We just released Azure Resources v.0.10.1 which includes the fix for this issue.

@Hanif-A
Copy link

Hanif-A commented Jan 1, 2025

We just released Azure Resources v.0.10.1 which includes the fix for this issue.

I just upgraded to 0.10.1, and it's working again.

Many thanks for the swift response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests