envsafe
envsafe copied to clipboard
Not working on nextjs
I am trying to setup envsafe in a NextJs project, but it is not working. The values are printed in console, on the server side also client side but still the validation is showing them as missing.
Printed value in NextJs dev server:
Browser console is showing the value and also the validation error.
The validation code:
import { str, envsafe, url, bool } from 'envsafe';
console.log('NEXT_PUBLIC_RUM_KEY' + process.env.NEXT_PUBLIC_RUM_KEY);
export const env = envsafe({
NEXT_PUBLIC_RUM_KEY: str(),
});
Node version: v16.18.1 NextJs version: 13.2.4
you should probably use input
for next.js public variables as shown here