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

Cannot build in versions after next@14.1.0 #65429

Closed
ravinggenius opened this issue May 7, 2024 · 2 comments
Closed

Cannot build in versions after next@14.1.0 #65429

ravinggenius opened this issue May 7, 2024 · 2 comments
Labels
bug Issue was opened via the bug report template. Developer Experience Issues related to Next.js logs, Error overlay, etc.

Comments

@ravinggenius
Copy link

ravinggenius commented May 7, 2024

Link to the code that reproduces this issue

https://github.com/ravinggenius/minecraft-tools/tree/updates

To Reproduce

  1. Clone project and checkout the updates branch
  2. Configure environment: cp .env .env.local and fill in the missing values
  3. Install exact dependencies: npm ci
  4. Build project: npm run build runs as expected
  5. Install any newer version of Next past 14.1.0: npm install next
  6. Build project again and notice the absolute dump of minified JavaScript in the output

Current vs. Expected behavior

I expect to be able to install newer version of Next to keep my dependencies up-to-date. However every newer version of Next beyond 14.1.0 terminates the build process early and dumps a ton (2.1MB!) of minified JavaScript into the terminal. I've tried multiple versions of Next 14.1.x and 14.2.x with the same result.

I am also unable to run the dev server in any version past 14.1.0. Doing so produces copious erroneous output in the terminal when requesting a page.

Provide environment information

Operating System:
  Platform: linux (ChromeOS)
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sat, 17 Feb 2024 21:12:19 +0000
Binaries:
  Node: 18.18.2
  npm: 9.8.1
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.1.0
  eslint-config-next: 14.2.2
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Developer Experience

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local)

Additional context

I tested in the latest canary release (14.3.0-canary.44) also with the same result. You can find the full build output in this gist.

@ravinggenius ravinggenius added the bug Issue was opened via the bug report template. label May 7, 2024
@github-actions github-actions bot added the Developer Experience Issues related to Next.js logs, Error overlay, etc. label May 7, 2024
ravinggenius added a commit to ravinggenius/minecraft-tools that referenced this issue Jun 5, 2024
@ravinggenius ravinggenius changed the title Cannot build in versions after next@14.0.4 Cannot build in versions after next@14.1.0 Jun 5, 2024
@ravinggenius
Copy link
Author

I found a work-around, but I still don't understand the root cause. This function (https://github.com/ravinggenius/minecraft-tools/blob/a6ee5f4dba06f870bff9d861df216986cb36332e/src/i18n/server.ts#L41-L61) returns SupportedLocale (a string literal union) when run with Next 14.1.0. However in Next 14.1.1 and later, this function inexplicably returns Promise< SupportedLocale>. I'd really like to understand why it returns a promise, because nothing in the function appears to use promises. To be clear this function returns a promise in Next 14.1.1 and later, even without being maked async.

The work-around is simple: just call the function with await. To help remind me that it must be called with await, I also added async, though this has no effect on what it does.

@ravinggenius
Copy link
Author

I found my issue. I was holding it wrong! I had "use server"; at the top of this file, even though the functions it defined where not server actions. Dang that was painful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Developer Experience Issues related to Next.js logs, Error overlay, etc.
Projects
None yet
Development

No branches or pull requests

1 participant