If you are looking to learn more about the products and frameworks used in this sample, you can check out the following:
- Mongoose
- Azure Functions
- Azure Static Web Apps
- Cosmos DB with MongoDB API
- Azure Static Web App Samples
Despite our best efforts, nobody writes perfect code. When something goes wrong we need to figure out what happened. Here are a few tips, tricks and resources to help you out.
Exceeded language worker restart retry count for runtime:node. Shutting down and proactively recycling the Functions Host to recover
At the time of this writing, Azure Functions only supports Node.js 12. If you receive the above error message, it's likely because you have version 14 (or later) installed.
Troubleshooting steps:
- If you are using nvm, execute the following commands
nvm install 12
nvm use 12
- If you are not using nvm, uninstall Node.js 14 and install Node.js 12
TIP: Using a tool like nvm makes managing Node.js and packages easier
This error message (or any other indicating a missing module) typically indicates npm install
wasn't executed in the directory containing the functions (api in our case). We can resolve this by executing the following commands in a terminal or command window in the directory containing our project.
cd api
npm install
When hosting your site locally, the Functions host and Live Server host run on different ports. A proxy needs to be set for Live Server to route requests to your API. You can do this by ensuring the file .vscode/settings.json has the following content:
{
"azureFunctions.deploySubpath": "api",
"azureFunctions.postDeployTask": "npm install",
"azureFunctions.projectLanguage": "JavaScript",
"azureFunctions.projectRuntime": "~3",
"debug.internalConsoleOptions": "neverOpen",
"azureFunctions.preDeployTask": "npm prune",
"liveServer.settings.proxy": {
"enable": true,
"baseUri": "/api",
"proxyUri": "http://127.0.0.1:7071/api"
}
}