Пишу приложение на Nuxt. Не могу вывести список юзеров с таблицы users в Supabase. Появляется ошибка 500
"client.from is not a function"
(P.s я юзаю модуль @nuxtjs/supabase)
/server/api/users.ts
import { serverSupabaseClient } from '#supabase/server'
export default eventHandler(async (event) => {
const client = serverSupabaseClient(event)
const { data } = await client.from('users').select("*")
return { users: data }
})
package.json
{
"name": "online-shop",
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"@nuxtjs/supabase": "^1.2.0",
"@supabase/supabase-js": "^2.41.1",
"nuxt": "^3.11.1",
"vue": "^3.4.21",
"vue-router": "^4.3.0"
}
}
nuxt.config.ts
import { name } from './package.json'
export default defineNuxtConfig({
devtools: { enabled: true },
modules: ['@nuxtjs/supabase'],
supabase: { redirect: false },
app: {
head: {
title: name,
link: [
{ rel: 'stylesheet', href: 'https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css', integrity: "sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC", crossorigin: "anonymous" },
]
},
},
})
.env
SUPABASE_URL="<supabase_url>"
SUPABASE_KEY="<supabase_key>"
Помогите, пожалуйста.