Nitro · Runtime config

NITRO0026Read server settings from runtime config, not process.env

Flags process.env reads in Nitro server files.

Why it happens

Nitro maps NITRO_ and NUXT_ environment variables onto runtimeConfig at startup, with types and defaults in one place. process.env is empty on Cloudflare Workers and other runtimes without a Node process, and a key read straight from it bypasses that contract.

Fix

Declare the setting in runtimeConfig and read it with useRuntimeConfig(); override it with NUXT_<KEY> or NITRO_<KEY> at runtime.

Example

Read the mail sender from runtime config

Before

const from = process.env.MAIL_FROM

After

// nuxt.config.ts: runtimeConfig: { mailFrom: '' }, set with NUXT_MAIL_FROM
const { mailFrom } = useRuntimeConfig()

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm vite-doctor . --framework nitro --rules nitro/runtime/no-process-env-in-server
Copyright © 2026