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

Unable to parse host configuration file #10421

Open
ccarmannt opened this issue Aug 22, 2024 · 9 comments
Open

Unable to parse host configuration file #10421

ccarmannt opened this issue Aug 22, 2024 · 9 comments
Assignees

Comments

@ccarmannt
Copy link

Investigative information

Azure fails to parse the attached host.json file.
It provides only this error in the portal:

System.FormatException : Unable to parse host configuration file 'C:\home\site\wwwroot\host.json'. ---> 
Newtonsoft.Json.JsonReaderException : After parsing a value an unexpected character was encountered: ". Path 'extensions', line 8, position 4

But there is no "extensions" element in the file. Is it being read from a cache somewhere?

  • Timestamp: Today, 22 August, 1537 New York time

Expected behavior

The file should be parsed correctly.

Actual behavior

The file is not parsed correctly.

Known workarounds

None found.
I have attempted restarting the app. I have attempted stopping the app for a while and then restarting it. Neither was effective.
Additionally, running the function in my local development environment works fine, no complaints about this file.

Related information

host.json

@bhagyshricompany
Copy link

Thanks for informing please share the repro steps and host.json file config.

@ccarmannt
Copy link
Author

The config file is already attached.

I don't have a known reproducible scenario. All I know is I changed it somehow that caused the parsing error, then reverted to the original. But after reverting to the original, the error didn't go away.

@bhagyshricompany
Copy link

ok will check and update

@simonlindner
Copy link

I have the same Error. I already tried to remove the Function and Create a new one, restarting the function, removing the host.json file and adding it again. That all did not work.

@bhagyshricompany
Copy link

it working fine locally as well as azure portal .Image
Image

@ccarmannt
Copy link
Author

@bhagyshricompany That is 2 months too late, and completely incorrect.

@bhagyshricompany
Copy link

Thanks for your patience @ccarmannt what is incorrect?I just used your config file and tested it seems working fine.if you need more specific please mention what missing.Thanks

@ccarmannt
Copy link
Author

The problem is that this is the configuration I uploaded and the server failed to parse it. It then continued to fail to parse it for several days, before magically fixing itself.

There is nothing I can find to explain either the parsing failure or the magical fix.

@dsun615
Copy link

dsun615 commented Nov 15, 2024

I got the same error as well and was able to find the issue and fix it.

It look like the host.json file didn't get uploaded even though the deployment said it was successful.

In Azure, find your Azure Function and checked the App Files under Functions.

It should show your host.json file. Mine was empty. Hence why we get the "Unable to parse host configuration file" error.

I've copied my host.json file from my local into Azure and the error went away.

Hope that helps.

Image

Below is the json I updated it to.

{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
}
}

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

No branches or pull requests

4 participants