标签: supabase-js

找不到模块:无法解析“/vercel/path0/node_modules/cross-fetch/node_modules/node-fetch/lib”中的“编码”

有没有人遇到过 npm 包带来的不间断警告问题:@supabase/supabase-js

The warning message:

warn  - ./node_modules/cross-fetch/node_modules/node-fetch/lib/index.js
Module not found: Can't resolve 'encoding' in '/Users/maxsilva/Sites/kamapay/sasa-frontend/node_modules/cross-fetch/node_modules/node-fetch/lib'

Import trace for requested module:
./node_modules/cross-fetch/node_modules/node-fetch/lib/index.js
./node_modules/cross-fetch/dist/node-ponyfill.js
./node_modules/@supabase/supabase-js/dist/main/lib/fetch.js
./node_modules/@supabase/supabase-js/dist/main/SupabaseClient.js
./node_modules/@supabase/supabase-js/dist/main/index.js
./lib/supabaseClient.js
./app/[lng]/page.jsx
Run Code Online (Sandbox Code Playgroud)

npm next.js supabase supabase-database supabase-js

22
推荐指数
1
解决办法
2万
查看次数

Next.js 12 + Supabase 项目错误“不存在保存会话的存储选项”

我正在使用 Supabase 和 Next.js 12.3.4 开发一个项目,并且我已经使用本教程设置了 Google 登录:Supabase Login with Google。当我运行项目时,终端反复警告

No storage option exists to persist the session, which may result in unexpected behavior when using auth.
        If you want to set persistSession to true, please provide a storage option or you may set persistSession to false to disable this warning.
Run Code Online (Sandbox Code Playgroud)

这是登录代码:

import supabaseClient from "./supabaseClient";

export default async function signInWithGoogle() {
    const { data, error } = await supabaseClient.auth.signInWithOAuth({
        provider: 'google',
        options: {
            redirectTo: 'http://localhost:3000/account'
        } …
Run Code Online (Sandbox Code Playgroud)

next.js supabase-js

5
推荐指数
2
解决办法
5700
查看次数

有没有更好的方法来访问 Supabase 生成的 TS 类型?

我在我的 supabase 数据库中创建了一个名为的表customer。使用生成我的类型

npx supabase gen types typescript --project-id "$PROJECT_REF" --schema public > types/supabase.ts
Run Code Online (Sandbox Code Playgroud)

在我的 React 应用程序中,这就是我引用生成类型的方式。

const [customerDetails, setCustomerDetails] = useState<Database["public"]["Tables"]["customer"]["Row"]>()
Run Code Online (Sandbox Code Playgroud)

能不能再干净一点,像这样?

const [customerDetails, setCustomerDetails] = useState<customer>()
Run Code Online (Sandbox Code Playgroud)

types typescript supabase supabase-js

2
推荐指数
1
解决办法
929
查看次数