TanStackT
TanStack6mo ago
5 replies
rubber-blue

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):

const CONVEX_URL = (import.meta as any).env.VITE_CONVEX_URL!
  if (!CONVEX_URL) {
    console.error('missing envar CONVEX_URL')
  }
  const convexQueryClient = new ConvexQueryClient(CONVEX_URL)
Was this page helpful?