wmalarski / qwik-authjs-example

Next-Auth.js + Qwik example integration
MIT License
27 stars 5 forks source link

__vite_ssr_import_0__.NextAuthHandler is not a function #4

Open bbigras opened 1 year ago

bbigras commented 1 year ago

to reproduce:

09 h 43 min 56 s [vite] Internal server error: __vite_ssr_import_0__.NextAuthHandler is not a function
      at getServerSession (/src/server/auth/auth.ts:83:45)
      at eval (/src/server/auth/withSession.ts:7:31)
      at async eval (/src/utils/endpointBuilder.ts:5:42)
      at async next (/home/bbigras/src/qwik-next-auth-example/node_modules/@builder.io/qwik-city/vite/index.cjs:26808:33)
      at async loadUserResponse (/home/bbigras/src/qwik-next-auth-example/node_modules/@builder.io/qwik-city/vite/index.cjs:26821:3)
      at async /home/bbigras/src/qwik-next-auth-example/node_modules/@builder.io/qwik-city/vite/index.cjs:27192:32 (x3)
wmalarski commented 1 year ago

Hello. I updated dependencies to the latest here https://github.com/wmalarski/qwik-authjs-example/pull/5. I switched from next-auth to new auth.js. This example should work fine for dev and preview modes. But there are still some issues with running the express adaptor. I don't know what's happening there yet.

bbigras commented 1 year ago

there are still some issues with running the express adaptor. I don't know what's happening there yet.

If you mean this error: TypeError [ERR_INVALID_STATE]: Invalid state: WritableStream is closed

It seems that updating qwik and qwik-city fixes it!

diff --git a/package.json b/package.json
index 578600a..5202e14 100644
--- a/package.json
+++ b/package.json
@@ -23,8 +23,8 @@
     "qwik": "qwik"
   },
   "devDependencies": {
-    "@builder.io/qwik": "0.16.2",
-    "@builder.io/qwik-city": "0.1.0-beta9",
+    "@builder.io/qwik": "0.17.5",
+    "@builder.io/qwik-city": "0.1.0",
     "@types/compression": "^1.7.2",
     "@types/cookie": "^0.5.1",
     "@types/eslint": "8.4.10",