vercel / vercel/next.js

error TypeError: Cannot read properties of undefined (reading '') when using Next.js runtime edge on turborepo or Nx

Open
#53,562 30 comments 26 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

linear: next Runtime
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Verify canary release
  • I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Pro   
    Binaries:
      Node: 18.16.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant Packages:
      next: 13.4.13-canary.13   
      eslint-config-next: 13.4.1
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 4.9.5
    Next.js Config:
      output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)

App Router, Middleware / Edge (API routes, runtime)

Link to the code that reproduces this issue or a replay of the bug

https://github.com/NastykSwED/turbo-next-edge

To Reproduce
  1. Run pnpm install to install the dependencies.
  2. Run pnpm dev to get both projects up or run pnpm dev --filter [docs | web].
  3. Go to http://localhost:3001/ or http://localhost:3000/ and see the console for the following error:
    Screenshot_1

And in the browser:
Screenshot_2

Describe the Bug

When using the runtime edge on a monorepo such as turborepo or Nx, the console throws the error: "- error TypeError: Cannot read properties of undefined (reading '')". This only happens with monorepos, when using standalone applications this does not happen.

Expected Behavior

It should not throw the above error when using a Nextjs app with the runtime edge on a monorepo.

Which browser are you using? (if relevant)

Microsoft Edge Versión 115.0.1901.188 (Compilación oficial) (64 bits)

How are you deploying your application? (if relevant)

No response

NEXT-1513

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked turbo-next-edge reproduction and run pnpm install followed by pnpm dev, or pnpm dev --filter docs or web. Compare the monorepo behavior with a standalone Next.js app using the edge runtime, focusing on the App Router and Middleware / Edge areas named in the report. Done means the reproduced applications start without the undefined-property error in the console or browser.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, react
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.