Seeing encrypted:ciphertext only?

Check that Next.js is using the encrypted environment loader.
← Back to Next.js

Next.js may still be using the original @next/env package, even after adding the override. Check which package is installed:

$ npm ls @next/env
$ pnpm why @next/env

The output should show @next/env as an alias of @dotenvx/next-env. An original Next.js version followed by “overridden” does not mean the replacement was installed.

If the original package is still installed, stop the dev server with Ctrl+C. From your project directory, rebuild the dependency installation:

$ rm -rf node_modules package-lock.json
$ npm install
$ npm ls @next/env
$ rm -rf node_modules pnpm-lock.yaml
$ pnpm install
$ pnpm why @next/env

Confirm the alias now points to @dotenvx/next-env, then restart:

$ npm run dev
$ pnpm dev

Refresh /api/hello. Review the regenerated lockfile before committing, since reinstalling can update dependency versions.

Open page ↗

Side path