next.js: `Cannot find module 'next/dist/next-server/server/node-polyfill-fetch'` for vercel monorepo serverless functions

Bug report

Hi, first of all love your work!

I’m migrating to use the NEW monorepo support for vercel,

and although the functions succeed to deploy, I get the following error when invoking it.

Describe the bug

Cannot find module 'next/dist/next-server/server/node-polyfill-fetch'

To Reproduce

Reproduction coming …

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of Next.js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

Additional context

Add any other context about the problem here.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 13
  • Comments: 27 (15 by maintainers)

Most upvoted comments

We’ve tracked down the issue yesterday and the team is working on a fix 🙏

The team is taking a look as we speak. It should be resolved in a few days.

Our apologies for the inconvenience.

You can test the fix by following these steps:

  • Include the following environment variable in your deployment (through the environment variables UI): Key: FORCE_BUILDER_TAG. Value: canary image

  • If you have a vercel.json file, then you can follow the same method:

{
  "build": {
    "env": {
      "FORCE_BUILDER_TAG": "canary"
    }
  }
}

Let us know if you have any positive results.

Hello everyone 👋 A fix has been shipped to canary (@vercel/next@canary). I will post updates on how to try it out here.

@vongohren Thank you for the comment! You gave me a hint that I maybe have the same issue. Comparing with your file I found out that line config.devtool = 'eval-source-map'; is causing this error on Vercel in my case.

Removing it or adding conditional dev/build check helped for me.

Even though I resolved my issue, I haven’t found any docs about it and in my custom server project I haven’t had the issue with source-map enabled.

I find it handy on dev servers to be able to inspect scripts. Is this bug? Or designed behaviour? Where can I read the info about webpack settings that should be blocked on serverless vercel deploy?