Back to Withastro

envPrefix conflicts with secret environment variables

src/content/docs/en/reference/errors/env-prefix-conflicts-with-secret.mdx

latest966 B
Original Source

import DontEditWarning from '~/components/DontEditWarning.astro'

<DontEditWarning />

EnvPrefixConflictsWithSecret: The following environment variables are declared with access: "secret" in env.schema, but their names match a prefix in vite.envPrefix, which would expose them in client-side bundles:

CONFLICTS.MAP((C) =\ >- ${C).join(' ')}

Either remove the conflicting prefixes from vite.envPrefix, or rename these variables to use a prefix not in vite.envPrefix.

What went wrong?

The configured vite.envPrefix includes prefixes that match environment variables declared with access: "secret" in env.schema. This would cause Vite to expose those secret values in client-side JavaScript bundles, bypassing the access: "secret" protection.

To fix this, either:

  • Remove the conflicting prefixes from vite.envPrefix, or
  • Rename your secret environment variables to use a prefix that is not in vite.envPrefix.