'supabaseauth-helpers-nextjs' gives SyntaxError Unexpected token 'export'

Just adding '@supabase/auth-helpers-nextjs' so I can access user session in an API Route and this line:

import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'


Causes this message to appear in the terminal:

SyntaxError: Unexpected token 'export'


Without that import the endpoint is fine,

From my package.json:

"next": "12.0.7",
"@supabase/supabase-js": "^2.2.1",
"@supabase/auth-helpers-nextjs": "^0.5.2",
"@supabase/auth-helpers-react": "^0.3.1",


All the client side auth seems to be working fine (I had to upgrade @supabase/supabase-js from 1.3.5 to 2.2.1)

Any ideas on how to fix this would be very appreciated.

Thanks
Was this page helpful?