Home > Net >  Cannot destructure property 'supabaseUrl' of 'getConfig(...)' as it is undefined
Cannot destructure property 'supabaseUrl' of 'getConfig(...)' as it is undefined

Time:10-18

I followed @supabase/auth-helpers-sveltekit guide on how to integrate supabase-auth helpers with sveltekit.

Yet, when running the dev server, I get an internal error

Cannot destructure property 'supabaseUrl' of 'getConfig(...)' as it is undefined.
TypeError: Cannot destructure property 'supabaseUrl' of 'getConfig(...)' as it is undefined.
    at getRequestSupabaseClient (file:///.../node_modules/.pnpm/@supabase [email protected]_pkve26evzxp6f7qgiud6o7i2nm/node_modules/@supabase/auth-helpers-sveltekit/dist/utils/supabase-request.js:10:13)
    at Proxy.getServerSession (file:///.../node_modules/.pnpm/@supabase [email protected]_pkve26evzxp6f7qgiud6o7i2nm/node_modules/@supabase/auth-helpers-sveltekit/dist/utils/getServerSession.js:3:22)
    at load (/.../src/routes/ layout.server.ts:6:23)
    at load_server_data (file:///.../node_modules/.pnpm/@sveltejs [email protected][email protected] [email protected]/node_modules/@sveltejs/kit/src/runtime/server/page/load_data.js:31:41)
    at respond_with_error (file:///.../node_modules/.pnpm/@sveltejs [email protected][email protected] [email protected]/node_modules/@sveltejs/kit/src/runtime/server/page/respond_with_error.js:40:32)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async resolve (file:///.../node_modules/.pnpm/@sveltejs [email protected][email protected] [email protected]/node_modules/@sveltejs/kit/src/runtime/server/index.js:254:12)
    at async respond (file:///.../node_modules/.pnpm/@sveltejs [email protected][email protected] [email protected]/node_modules/@sveltejs/kit/src/runtime/server/index.js:287:20)
    at async file:///.../node_modules/.pnpm/@sveltejs [email protected][email protected] [email protected]/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:407:22

CodePudding user response:

Solved thx to github issue.

The problem was that I imported createClient (in $lib/db) from

import { createClient } from '@supabase/supabase-js'

instead of

import { createClient } from '@supabase/auth-helpers-sveltekit'

  • Related