Skip to content

Latest commit

 

History

History
61 lines (43 loc) · 2.66 KB

troubleshooting-and-resources.md

File metadata and controls

61 lines (43 loc) · 2.66 KB

Resources

If you are looking to learn more about the products and frameworks used in this sample, you can check out the following:

Troubleshooting

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.

Common error messages when running locally

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

TIP: Using a tool like nvm makes managing Node.js and packages easier

Worker was unable to load function tasks: 'Error: Cannot find module 'mongoose'

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

API returns a 404

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"
    }
}