nextjs - 💡(How to fix) Fix When Turbopack is enabled, generateBuildId executes on next dev [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#86482Fetched 2026-04-08 02:10:41
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×2closed ×1commented ×1issue_type_added ×1

Error Message

You should see the following error thrown This remains true if you build with webpack via next dev --webpack. When webpack is enabled, the error that I added to the repo to reproduce the error will not be thrown.

Code Example

Latest Commit REVISION not set for the environment! This is required for the Build ID.

---

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Wed Oct 15 21:12:09 PDT 2025; root:xnu-11417.140.69.703.14~1/RELEASE_ARM64_T6031
  Available memory (MB): 36864
  Available CPU cores: 14
Binaries:
  Node: 22.8.0
  npm: 8.19.2
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 16.0.4 // Latest available version is detected (16.0.4).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/besh/generate-build-id-test

To Reproduce

  1. Start the application in development (next dev)

You should see the following error thrown

Latest Commit REVISION not set for the environment! This is required for the Build ID.

Current vs. Expected behavior

According to the documentation, generateBuildId should NOT execute when running next dev

Next.js generates an ID during next build to identify which version of your application is being served. The same build should be used and boot up multiple containers.

This remains true if you build with webpack via next dev --webpack. When webpack is enabled, the error that I added to the repo to reproduce the error will not be thrown.

We encountered this breaking change while migrating our application to Turbopack. If this is expected behavior, I can push up a documentation change.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Wed Oct 15 21:12:09 PDT 2025; root:xnu-11417.140.69.703.14~1/RELEASE_ARM64_T6031
  Available memory (MB): 36864
  Available CPU cores: 14
Binaries:
  Node: 22.8.0
  npm: 8.19.2
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 16.0.4 // Latest available version is detected (16.0.4).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

Turbopack

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

next dev (local)

Additional context

No response

extent analysis

TL;DR

The issue can be resolved by ensuring that the generateBuildId function is properly configured to handle the next dev command with Turbopack.

Guidance

  • Review the next.config.js file to ensure that the generateBuildId function is correctly implemented and handles the next dev command.
  • Verify that the REVISION environment variable is set when running next dev with Turbopack.
  • Check the Next.js documentation for any specific requirements or recommendations for using generateBuildId with Turbopack.
  • Consider adding a conditional statement to the generateBuildId function to handle the difference in behavior between next build and next dev.

Example

// next.config.js
module.exports = {
  // ...
  generateBuildId: async () => {
    if (process.env.NODE_ENV === 'development') {
      // Handle next dev with Turbopack
      return 'development-build-id';
    }
    // Handle next build
    return 'production-build-id';
  },
};

Notes

The issue seems to be related to the change in behavior when using Turbopack with next dev. The generateBuildId function is not properly handling this scenario, resulting in the error.

Recommendation

Apply workaround: Modify the generateBuildId function to handle the next dev command with Turbopack, as shown in the example above. This will allow the application to run without errors when using Turbopack with next dev.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING