supabase-community / nuxt-supabase

A supa simple wrapper around Supabase.js to enable usage within Nuxt.
https://supabase.io
MIT License
167 stars 17 forks source link

TypeError: kit.addServerMiddleware is not a function. #25

Open kouwasi opened 2 years ago

kouwasi commented 2 years ago

Bug report

TypeError: kit.addServerMiddleware is not a function

Describe the bug

Clould'nt start nuxt dev server.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create Nuxt 2 project with the nuxt-app with
    ? Programming language: TypeScript
    ? Package manager: Yarn
    ? UI framework: Vuetify.js
    ? Template engine: HTML
    ? Linting tools: ESLint, Prettier
    ? Testing framework: Jest
    ? Rendering mode: Single Page App
    ? Deployment target: Static (Static/Jamstack hosting)
    ? Development tools: jsconfig.json (Recommended for VS Code if you're not using typescript)
  2. Add this package to the project and add nuxt-supabase module to nuxt.config.js. image
  3. Run the yarn run dev
  4. See error

Expected behavior

I expected to run the nuxt server corectlly.

Screenshots

image

System information

Additional context

I guess the problem happend from https://github.com/supabase-community/nuxt-supabase/blob/271db1b3216b7f1509ebd958553676f978bf0406/src/module.ts#L38-L41

kouwasi commented 2 years ago

Oops. I was doing written to a wrong section buildModules. I moved to a right section modules, But it still not working.

image

andisulistyonugroho commented 2 years ago

For nuxt2 try version 1.0.8 npm install nuxt-supabase@1.0.8

syntheticgoo commented 1 year ago

For nuxt2 try version 1.0.8 npm install nuxt-supabase@1.0.8

This worked for me. Maybe docs just need to be updated?

sduduzog commented 1 year ago

Maybe the supabase version needs to be pinned before work for the v2 client is published

mssrlefrancois commented 1 year ago

For nuxt2 try version 1.0.8 npm install nuxt-supabase@1.0.8

This worked for me also. Thanks a lot.

kouwasi commented 1 year ago

The version 1.0.8 is just injecting supabase client to Vue's DI container. Therefore this module is not needed IMO. And the @supabase/supabase-js as dependency is too old, about 2 years ago.

When guys want to use supabase client in Nuxt 2 without SSR, Just make a Nuxt plugin for provide supabase client. I think that correct way to use latest supabase client.

In this issue I'm talking about this bug. I mean SSR features of v2 in this module.

v1.0.8 DOES NOT HAVE IMPLEMENTED SSR FEATURES. LOOKS LIKE WORKING, BUT IT HAS NOT WORKS.

Please forcus to the described bug.

kouwasi commented 1 year ago

I'll try to fix the bug myself to take more convenience.

tfiliano commented 1 year ago

I am getting the same issue, does anyone fixed it?

vincent2021 commented 1 year ago

I got the same error. Does anyone managed to fix it ?

vincent2021 commented 1 year ago

Switching to release 2.2.1 works fine on my side.