netlify deploy error
When deploying to Netlify, It fails building the app, with the message that env vars shouldn't be used in client code. How can I solve this??
Netlify logs:
11:45:38 PM: Secret env var "VITE_CONVEXURL"'s value detected:
found value at line 1464 in .netlify/functions-internal/server/chunks//ssr.mjs
11:45:38 PM: found value at line 68 in .tanstack/start/build/client-dist/assets/main-BHcXIkoc.js
11:45:38 PM: found value at line 68 in dist/assets/main-BHcXIkoc.js
11:45:38 PM:
11:45:38 PM: To prevent exposing secrets, the build will fail until these secret values are not found in build output or repo files.
Refering to this code (I think):
5 Replies
stormy-gold•2mo ago
cc @Netlify (Partner)
fair-roseOP•2mo ago
I used process.env.___, and now there's no error. Not sure why...
harsh-harlequin•2mo ago
process.env is generally for envs destined for the server
import.meta.env.VITE_<name> is for client
xenial-black•2mo ago
You can also check out "Manage false positives" here: https://docs.netlify.com/manage/security/secret-scanning/
fair-roseOP•5w ago
Thanks, that's what I found out...