-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
feature / enhancementNew feature or requestNew feature or requestpkg:adapter-vercelPertaining to the Vercel adapterPertaining to the Vercel adapter
Milestone
Description
Describe the problem
Edge functions in Vercel do not work as expected. You have to specify the variable EXACTLY in process.env for it to work, while $env seem to get translated automatically in regular lambdas.
It would be nice if all $env variables were replaced with process.env so that I would not have to configure it manually with something like:
import { env } from '$env/dynamic/public';
import { createClient } from '@supabase/supabase-js';
const isLocal = Object.keys(env).length;
export const supabase = createClient(
(isLocal ? env.PUBLIC_SUPABASE_URL : process.env.PUBLIC_SUPABASE_URL) as string,
(isLocal ? env.PUBLIC_SUPABASE_ANON_KEY : process.env.PUBLIC_SUPABASE_ANON_KEY) as string
);Describe the proposed solution
The vercel adapter does this if the edge: true is set.
Alternatives considered
My workaround code above.
Importance
would make my life easier
Additional Information
Obviously this would not be necessary if SvelteKit handled this internally, or if Vercel Edge functions handled env variables the same way as regular functions.
avarun42, AgarwalPragy, milesgranger, balazsorban44 and julien-blanchon
Metadata
Metadata
Assignees
Labels
feature / enhancementNew feature or requestNew feature or requestpkg:adapter-vercelPertaining to the Vercel adapterPertaining to the Vercel adapter