Netlify CLI: default function export works in production, but not locally

Reduced Test case Git repo: GitHub - brob/netlify-durable-cache-test
Working production function: https://candid-sherbet-49d76c.netlify.app/travel-guide/city/country

Taking the example from the docs here: Get started with functions | Netlify Docs

Using this locally, throws the following error:

TypeError - lambdaFunc[lambdaHandler] is not a function

In production, this works fine.

Locally, i can make the function not throw an error by exporting it with a handler variable, but that triggers the Lambda compatibility and makes context.params not work (nor the exported Config object) because those don’t work in compat mode.

Version for the CLI locally (accessed via netlify -v:

netlify-cli/17.37.1 darwin-arm64 node-v21.0.0

Just installed the CLI local to my project and ran via npx netlify dev and that seems to make it work.

The global netlify dev command appears to be giving it the main issue here

You likely have multiple versions of Netliify CLI installed - most likely the global installation is the old one.

Running netlify -v globally returns 17.37.1

This is definitely something with my setup, but strange that it runs that version with the command but still doesn’t work. Local installations of the CLI work, so at least I’ve got that as a workaround.