Netlify function cannot find module (w/ minimum code example)

I am running into a problem using lambda functions:

create a new netlify project, and create a single netlify function file /netlify/functions/ipfsTest.ts :

import { Handler } from "@netlify/functions";
import { create } from "ipfs-core"

const handler: Handler = async (event) => {
    const ipfs = await create();

    return {
        statusCode: 200,
        body: JSON.stringify({ message: ipfs.toString() }),

export { handler };

Run netlify functions:serve and go to the URL for the function ipfsTest, and you may get

Error - Cannot find module ‘./fetch.node’ Require stack: - /Users/zipzap/Dev/crypto/ipfsFunctionsTest/.netlify/functions-serve/ipfsTest/src/netlify/functions/ipfsTest.js - /Users/zipzap/Dev/crypto/ipfsFunctionsTest/.netlify/functions-serve/ipfsTest/ipfsTest.js - /Users/zipzap/.config/yarn/global/node_modules/lambda-local/build/lambdalocal.js - /Users/zipzap/.config/yarn/global/node_modules/netlify-cli/src/lib/functions/runtimes/js/index.js - /Users/zipzap/.config/yarn/global/node_modules/netlify-cli/src/lib/functions/runtimes/index.js - /Users/zipzap/.config/yarn/global/node_modules/netlify-cli/src/lib/functions/registry.js - /Users/zipzap/.config/yarn/global/node_modules/netlify-cli/src/lib/functions/server.js - /Users/zipzap/.config/yarn/global/node_modules/netlify-cli/src/commands/dev/dev.js - /Users/zipzap/.config/yarn/global/node_modules/netlify-cli/src/commands/dev/index.js - /Users/zipzap/.config/yarn/global/node_modules/netlify-cli/src/commands/main.js - /Users/zipzap/.config/yarn/global/node_modules/netlify-cli/src/commands/index.js - /Users/zipzap/.config/yarn/global/node_modules/netlify-cli/bin/run

I believe that the ‘./fetch.node’ is referring to the file ipfs-core/src/http/fetch.node.js, but for whatever reason, when it is run as a lambda function, it does not build or load the file properly.
Here is the contents of my package.json:

  "name": "ipfsFunctionsTest",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "devDependencies": {},
  "dependencies": {
    "@netlify/functions": "^1.0.0",
    "ipfs-core": "^0.15.4"

Anybody have any ideas?
this happens both with the ipfs-core module, and the ipfs-http-client module.
I have been trying to figure this out all day, and I am about to throw in the towel!

Hi @zipzapzanigan,

The solution here is to add the following to your netlify.toml:

  external_node_modules = ["ipfs-utils"]

You can read more about it here:

We’ve opened an issue with the devs to log that better during the dev mode. However, if you had run netlify build -offline, you’d have found the solution too:

Packaging Functions from netlify/functions directory:
 - ipfsTest.ts
❯ The following Node.js modules use dynamic expressions to include files:
   - ipfs-utils
  Because files included with dynamic expressions aren't bundled with your serverless functions by default,
  this may result in an error when invoking a function. To resolve this error, you can mark these Node.js
  modules as external in the [functions] section of your `netlify.toml` configuration file:
    external_node_modules = ["ipfs-utils"]
  Visit for more information.
(Functions bundling completed in 1.2s)

The CLI logs that to warn about it when “building” the production version. The issue that we’ve raised with the devs is to log this during the dev and functions:serve command too.