Seeking help with tutorial: How to Develop a Web App With Netlify Serverless Functions and MongoDB

I’m trying to follow this tutorial:

I thought it was going well but when I run ‘netlify dev’ I get an error (full output below). For one thing, I don’t understand why it says it is setting up the Edge Functions environment when I definitely selected serverless from the prompts generated by ‘netlify functions:create --name get_movies’

I’ve checked that I have set the MONGODB_ environment variables and my IP address is allowed.

$ netlify dev
\u2b25 Injecting environment variable values for all scopes
\u2b25 Ignored general context env var: LANG (defined in process)
\u2b25 No app server detected. Using simple static server
\u2b25 Unable to determine public folder to serve files from. Using current working directory
\u2b25 Setup a netlify.toml file with a [dev] section to specify your dev server settings.
\u2b25 See docs at: https://docs.netlify.com/cli/local-development/#project-detection
\u2b25 Running static server from "mongodb2"
\u2b25 Setting up local dev server

\u2b25 Static server listening to 3999
\u2b25 Loaded function get_movies in Lambda compatibility mode

   \u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2b25\u2009 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e
   \u2502                                                   \u2502
   \u2502   Local dev server ready: http://localhost:8888   \u2502
   \u2502                                                   \u2502
   \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f

\u2716 Setting up the Edge Functions environment. This may take a couple of minutes.
 \u203a   Error: Netlify CLI has terminated unexpectedly
This is a problem with the Netlify CLI, not with your application.
If you recently updated the CLI, consider reverting to an older version by running:

npm install -g netlify-cli@VERSION

You can use any version from https://ntl.fyi/cli-versions.

Please report this problem at https://ntl.fyi/cli-error including the error details below.

Error: There was a problem setting up the Edge Functions environment. To try a manual installation, visit https://ntl.fyi/install-deno.
    at toError (file:///home/debian/.nvm/versions/node/v24.1.0/lib/node_modules/netlify-cli/dist/utils/command-helpers.js:152:16)
    at logAndThrowError (file:///home/debian/.nvm/versions/node/v24.1.0/lib/node_modules/netlify-cli/dist/utils/command-helpers.js:158:17)
    at prepareServer (file:///home/debian/.nvm/versions/node/v24.1.0/lib/node_modules/netlify-cli/dist/lib/edge-functions/proxy.js:148:16)
    at async Promise.all (index 1)
    at async file:///home/debian/.nvm/versions/node/v24.1.0/lib/node_modules/netlify-cli/dist/lib/edge-functions/proxy.js:73:41
    at async onRequest (file:///home/debian/.nvm/versions/node/v24.1.0/lib/node_modules/netlify-cli/dist/utils/proxy.js:610:35)

  System:
    OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (4) arm64 unknown
  Binaries:
    Node: 24.1.0 - ~/.nvm/versions/node/v24.1.0/bin/node
    npm: 11.3.0 - ~/.nvm/versions/node/v24.1.0/bin/npm
  npmGlobalPackages:
    netlify-cli: 22.1.1

Hey @Andy_Funk,

From the log, nothing really stands out as being a problem in the communication between MongoDB and Netlify.

Are you able to try netlify deploy to see if maybe there is a problem with your local configuration or the CLI version like the error suggests? The hosted Netlify building tool might be a little more polished than what they offer for local development.

I’m not sure what I had been doing wrong but when I returned to this today I did not see that same error.

I did have a different problem with ‘netlify dev’ but I’ve since learned that at a minimum I need to run ‘git init’ or else ‘netlify dev’ seems not to know where to serve files from. Of course, I need to be using a git repo anyway for the deploy step.

Once I got the web app working locally with ‘netlify dev’, I tried ‘netlify deploy’. At first my function was failing but I eventually realized that I needed to configure my MongoDB to allow connections from any IP address. So, I have been able to complete the tutorial.

Thanks!
Andy

Glad you got it working!