nuxt-modules / strapi

Strapi Module for Nuxt
https://strapi.nuxtjs.org
MIT License
621 stars 77 forks source link

Request Error: init is not a function #272

Open RndUsername opened 2 years ago

RndUsername commented 2 years ago

I've installed the module as described in the docs and I even tried the edge channel. Still both time when I start the server, it throws an 500 error client side and this on the server:

[nuxt] [request error] init is not a function
  at Module.useState (/Users/husband/Documents/Web%20Dev/NotABot%20website%20v2/website-v2/nuxt-project/.nuxt/dist/server/server.mjs:995:26)  
  at Module.useStrapiUser (/Users/husband/Documents/Web%20Dev/NotABot%20website%20v2/website-v2/nuxt-project/.nuxt/dist/server/server.mjs:3869:51)  
  at Module.useStrapiAuth (/Users/husband/Documents/Web%20Dev/NotABot%20website%20v2/website-v2/nuxt-project/.nuxt/dist/server/server.mjs:3740:38)  
  at /Users/husband/Documents/Web%20Dev/NotABot%20website%20v2/website-v2/nuxt-project/.nuxt/dist/server/server.mjs:3708:47  
  at fn (/Users/husband/Documents/Web%20Dev/NotABot%20website%20v2/website-v2/nuxt-project/.nuxt/dist/server/server.mjs:435:27)  
  at Object.callAsync (/Users/husband/Documents/Web%20Dev/NotABot%20website%20v2/website-v2/nuxt-project/node_modules/unctx/dist/index.mjs:49:19)  
  at callWithNuxt (/Users/husband/Documents/Web%20Dev/NotABot%20website%20v2/website-v2/nuxt-project/.nuxt/dist/server/server.mjs:437:23)  
  at applyPlugin (/Users/husband/Documents/Web%20Dev/NotABot%20website%20v2/website-v2/nuxt-project/.nuxt/dist/server/server.mjs:392:29)  
  at Module.applyPlugins (/Users/husband/Documents/Web%20Dev/NotABot%20website%20v2/website-v2/nuxt-project/.nuxt/dist/server/server.mjs:402:11)  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)

When i navigate to my index route I can get to my home page and the strapi module even gives me the correct respsonse from my strapi server back. But when I refresh the page I again get the same errors es described above. So in conclusion it works but still throws errors. I use Nuxt3 and StrapiV3.

FKonig commented 2 years ago

I get the same error:

[nuxt] [request error] init is not a function
  at Module.useState (./.nuxt/dist/server/server.mjs:993:26)  
  at Module.useStrapiUser (./.nuxt/dist/server/server.mjs:3184:51)  
  at Module.useStrapiAuth (./.nuxt/dist/server/server.mjs:3053:38)  
  at ./.nuxt/dist/server/server.mjs:3020:47  
  at fn (./.nuxt/dist/server/server.mjs:434:27)  
  at Object.callAsync (./node_modules/unctx/dist/index.mjs:42:19)  
  at callWithNuxt (./.nuxt/dist/server/server.mjs:436:23)  
  at applyPlugin (./.nuxt/dist/server/server.mjs:391:29)  
  at Module.applyPlugins (./.nuxt/dist/server/server.mjs:401:11)  
  at async createNuxtAppServer (./.nuxt/dist/server/server.mjs:46:7)
[nuxt] [request error] init is not a function
  at Module.useState (./.nuxt/dist/server/server.mjs:993:26)  
  at Module.useStrapiUser (./.nuxt/dist/server/server.mjs:3184:51)  
  at Module.useStrapiAuth (./.nuxt/dist/server/server.mjs:3053:38)  
  at ./.nuxt/dist/server/server.mjs:3020:47  
  at fn (./.nuxt/dist/server/server.mjs:434:27)  
  at Object.callAsync (./node_modules/unctx/dist/index.mjs:42:19)  
  at callWithNuxt (./.nuxt/dist/server/server.mjs:436:23)  
  at applyPlugin (./.nuxt/dist/server/server.mjs:391:29)  
  at Module.applyPlugins (./.nuxt/dist/server/server.mjs:401:11)  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)

I can replicate it in a fresh project only installing nuxt3 and nuxtjs/strapi.

I am running: Node v16.16.0 Strapi v4.3.6 Nuxt v3.0.0-rc.4

Linux, Pop_OS 20.04

Any ideas are welcome :)