Want to stop Next.js telemetry? Here is a quick tip. You can disable it via the command line or via the environment file.
If you are looking only at the command, you can skip this background information section and scroll to the disable section. According to the Next.js team, they collect telemetry data to improve the developer experience and to ensure its growth. This makes it easier for them to find where the users get stuck and the possible areas to improve. Also, they have mentioned that their manual improvement process slowed down the growth of Next.js.
Let’s begin by looking at what telemetry is. Telemetry is the automatic collection of data to a remote system. It helps to get more information about the environment and to access the performance.
This differs slightly from users reporting bugs and feedback. As the configuration differs for every user, telemetry helps to understand the users’ needs better.
Enough of the backstory. Let’s see what data is being collected.
- Next.js version and installed Next.js plugins
- Environment information (operating system, continuous integration is enabled or not, number of CPUs)
- Number of pages in the app
- How long it takes to build (on the next build command)
- Commands used (next dev, next export, or next build)
Debugging Telemetry Data
As a developer, you would like to see what Next.js collects, just like me.
You can debug telemetry data by adding NEXT_TELEMETRY_DEBUG=1 in your .env file. This allows you to check what data is being captured by telemetry. In debug mode, it doesn’t send data just outputs in the console.
For a quick demo, I’ve got this telemetry output from my existing Next.js app.
Whoa, that’s a lot of information to me! It does not contain any sensitive information like file paths, errors, logs, and environment variables.
By default, telemetry is enabled. That means you can opt out if you don’t want to share any data. It should be the other way around (I get what you’re thinking!).
To disable telemetry, you can add NEXT_TELEMETRY_DISABLED=1 to your .env file.
You can also run the command npx next telemetry disable in the root of your project directory.
Make sure that it is disabled by checking the telemetry status.
That did the trick! For more information, visit Next.js official documentation page.
Did you find this quick tip useful? We’ve got a ton of valuable information on Next.js. Read our Headless CMS tutorials.