Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextJS Turbopack FileSystemPath issue #19365

Closed
1 of 4 tasks
XEngine opened this issue Sep 28, 2023 · 16 comments · Fixed by #20536
Closed
1 of 4 tasks

NextJS Turbopack FileSystemPath issue #19365

XEngine opened this issue Sep 28, 2023 · 16 comments · Fixed by #20536
Assignees
Labels
outdated scope: nextjs Issues related to NextJS support for Nx type: bug

Comments

@XEngine
Copy link

XEngine commented Sep 28, 2023

Current Behavior

On a clean install from create-nx-workspace run nx serve org:development with --turbo flag giving this issue below

Error: content is not available as task execution failed
Caused by:
- Vc<FileSystemPath>("").join("../../apps/org/.next") leaves the filesystem root
Debug info:
- Execution of PageEndpoint::client_chunks failed
- content is not available as task execution failed
- Execution of FileSystemPath::join failed
- Vc<FileSystemPath>("").join("../../apps/org/.next") leaves the filesystem root
    at withErrorCause (C:\Users\tidus\Projects\org\node_modules\next\dist\build\swc\index.js:391:19)
    at async EndpointImpl.writeToDisk (C:\Users\tidus\Projects\org\node_modules\next\dist\build\swc\index.js:581:20)
    at async Object.ensurePage (C:\Users\tidus\Projects\org\node_modules\next\dist\server\lib\router-utils\setup-dev.js:758:69)
    at async Object.getFallbackErrorComponents (C:\Users\tidus\Projects\org\node_modules\next\dist\server\lib\router-server.js:100:17)
    at async DevServer.getFallbackErrorComponents (C:\Users\tidus\Projects\org\node_modules\next\dist\server\dev\next-dev-server.js:561:13)
    at async DevServer.renderErrorToResponseImpl (C:\Users\tidus\Projects\org\node_modules\next\dist\server\base-server.js:1871:40)
    at async pipe.req.req (C:\Users\tidus\Projects\org\node_modules\next\dist\server\base-server.js:1728:30)
    at async DevServer.pipeImpl (C:\Users\tidus\Projects\org\node_modules\next\dist\server\base-server.js:825:25) {
  [cause]: [Error: content is not available as task execution failed

  Caused by:
  - Vc<FileSystemPath>("").join("../../apps/org/.next") leaves the filesystem root

  Debug info:
  - Execution of PageEndpoint::client_chunks failed
  - content is not available as task execution failed
  - Execution of FileSystemPath::join failed
  - Vc<FileSystemPath>("").join("../../apps/org/.next") leaves the filesystem root] {
    code: 'GenericFailure'
  }
}

Expected Behavior

It should run without this kind of low level issue

GitHub Repo

No response

Steps to Reproduce

  1. run npx create-nx-workspace@latest
  2. run development with --turbo flag

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 19.9.0
   OS     : win32-x64
   npm    : 9.8.1

   nx                 : 16.9.1
   @nx/js             : 16.9.1
   @nx/jest           : 16.9.1
   @nx/linter         : 16.9.1
   @nx/workspace      : 16.9.1
   @nx/devkit         : 16.9.1
   @nx/eslint-plugin  : 16.9.1
   @nx/next           : 16.9.1
   @nx/react          : 16.9.1
   @nrwl/tao          : 16.9.1
   @nx/web            : 16.9.1
   typescript         : 5.1.6

Failure Logs

No response

Package Manager Version

Npm : 9.8.1

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

without turbo flag it runs okay

@AgentEnder AgentEnder added the scope: nextjs Issues related to NextJS support for Nx label Sep 29, 2023
@wescopeland
Copy link

wescopeland commented Oct 1, 2023

Same here on macOS & Node 16. Turbopack dumps the error shown in the OP and doesn't actually work.

@ndcunningham ndcunningham self-assigned this Oct 12, 2023
@Jackmekiss
Copy link

Any news on this?

@enchorb
Copy link

enchorb commented Oct 21, 2023

Same issue here. MacOS (M2), Node 18

@omerman
Copy link

omerman commented Oct 23, 2023

Any news? 😢

@ndcunningham
Copy link
Contributor

ndcunningham commented Oct 23, 2023

Hi sorry for the late response.
There seems to be an issue with how the latest turbopack retrieves nextjs file paths

At the moment the current workaround would be the use next.js v13.5.2 instead of latest until we have a stable fix for this.

Here is a related discussion: vercel/next.js#55987
Here is a related issue: vercel/next.js#56887

I'll leave the issue open until then.

@wescopeland
Copy link

Unfortunately, that is not a viable workaround for us.

Next.js 13.5.2 has some performance issues in the app router that are resolved in latest.
The related issue is a discussion - I would be very surprised if the team at Vercel were even aware of it.

@ndcunningham
Copy link
Contributor

I updated my comment with an actual issue. It seems to be happening with monorepos.
I think they are aware hopefully we see some more traction on the issue.

@omerman
Copy link

omerman commented Oct 28, 2023

I hope they are aware :/

@LuckeeDev
Copy link

Same issue here with Windows 11, Node v20.9.0, NextJS v14.0.0 and the following NX workspace:

 >  NX   Report complete - copy this into the issue template

   Node   : 20.9.0
   OS     : win32-x64
   yarn   : 1.22.19

   nx                 : 17.0.2
   @nx/js             : 17.0.2
   @nx/jest           : 17.0.2
   @nx/linter         : 17.0.2
   @nx/eslint         : 17.0.2
   @nx/workspace      : 17.0.2
   @nx/devkit         : 17.0.2
   @nx/eslint-plugin  : 17.0.2
   @nx/next           : 17.0.2
   @nx/node           : 17.0.2
   @nx/react          : 17.0.2
   @nrwl/tao          : 17.0.2
   @nx/web            : 17.0.2
   typescript         : 5.0.4
   ---------------------------------------
   Community plugins:
   @jscutlery/semver   : 3.0.0
   @nx-plus/docusaurus : 15.0.0-rc.0

@keyur2582
Copy link

Same here with NextJs 14.0.1

@theborowski
Copy link

Experiencing the same issue on linux, Node v20.9.0, NextJS v14.0.1.

 >  NX   Report complete - copy this into the issue template

   Node   : 20.9.0
   OS     : linux-x64
   pnpm   : 8.10.0
   
   nx                 : 17.0.2
   @nx/js             : 17.0.2
   @nx/jest           : 17.0.2
   @nx/linter         : 17.0.2
   @nx/eslint         : 17.0.2
   @nx/workspace      : 17.0.2
   @nx/cypress        : 17.0.2
   @nx/devkit         : 17.0.2
   @nx/eslint-plugin  : 17.0.2
   @nx/next           : 17.0.2
   @nx/react          : 17.0.2
   @nrwl/tao          : 17.0.2
   @nx/vite           : 17.0.2
   @nx/web            : 17.0.2
   typescript         : 5.2.2

@XEngine
Copy link
Author

XEngine commented Dec 1, 2023

I am just guessing this could be the fix of this : vercel/next.js#58798

Probably on the next release which is 14.0.4, thil will get fixed.

@wescopeland
Copy link

Unfortunately, on the latest Next.js canary the issue is still occurring.

@wescopeland
Copy link

I'm confused - I thought this issue was caused by turbopack itself and not related to something internal with Nx:

There seems to be an issue with how the latest turbopack retrieves nextjs file paths
At the moment the current workaround would be the use next.js v13.5.2 instead of latest until we have a stable fix for this.

If Vercel resolves an internal issue with turbopack, will this issue need to be re-opened?

@ndcunningham
Copy link
Contributor

ndcunningham commented Dec 6, 2023

To provide some context, the core problem stemmed from our plugin's behavior of producing a production build when the --turbo flag was intended solely for development purposes.

Given that our production builds are directed to the <workspaceRoot>/dist/<project-path> location, this arrangement falls outside the scope of the project's source directory, as stipulated by Next.js and enforced by Turbopack (hence the error).

This is from my testing since not much information has been communicated from Vercel.

In light of this, I don't believe it is necessary to reopen this issue for the mentioned reason. It's important to note that other monorepos, if they were to generate builds outside of their project source, would encounter a similar error.

I hopefully this clears things up. @wescopeland

Copy link

github-actions bot commented Jan 7, 2024

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: nextjs Issues related to NextJS support for Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants