Closed nikkorejz closed 11 months ago
same issue.
Same issue here, have no idea what it might be
Same issue here with version 0.6.0-beta.3
and local provider only and following log :
[nuxt] [request error] [unhandled] [500] Cannot access 'renderer$1' before initialization 23:29:40
at /S:/Projects/Web/naruto-leaf/frontend/.nuxt/dev/index.mjs:713:65
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.handler (/S:/Projects/Web/naruto-leaf/frontend/node_modules/h3/dist/index.mjs:1284:19)
at async toNodeHandle (/S:/Projects/Web/naruto-leaf/frontend/node_modules/h3/dist/index.mjs:1359:7)
at async Object.ufetch [as localFetch] (/S:/Projects/Web/naruto-leaf/frontend/node_modules/unenv/runtime/fetch/index.mjs:9:17)
at async Object.errorhandler [as onError] (/S:/Projects/Web/naruto-leaf/frontend/.nuxt/dev/index.mjs:685:30)
at async Server.toNodeHandle (/S:/Projects/Web/naruto-leaf/frontend/node_modules/h3/dist/index.mjs:1366:9)
I've had a similar issue. And had to take it unto myself to find the error, and fix it. So yeah! I think I've fixed the issue now. Here is the xxx.patch file code to use. Tell me if it takes care of your problem.
From 7e5c40a3171bc7b010dbda434d242aae16710cf4 Mon Sep 17 00:00:00 2001
From: GJM <contact@genitus.tech>
Date: Thu, 20 Jul 2023 16:59:06 +0200
Subject: [PATCH] fix: Cannot access 'renderer' before initialization. (#420)
---
.../dist/runtime/server/services/authjs/nuxtAuthHandler.mjs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/node_modules/@sidebase/nuxt-auth/dist/runtime/server/services/authjs/nuxtAuthHandler.mjs b/node_modules/@sidebase/nuxt-auth/dist/runtime/server/services/authjs/nuxtAuthHandler.mjs
index 09e2bf9..a150949 100644
--- a/node_modules/@sidebase/nuxt-auth/dist/runtime/server/services/authjs/nuxtAuthHandler.mjs
+++ b/node_modules/@sidebase/nuxt-auth/dist/runtime/server/services/authjs/nuxtAuthHandler.mjs
@@ -11,7 +11,7 @@ import { useRuntimeConfig } from "#imports";
let preparedAuthHandler;
let usedSecret;
const SUPPORTED_ACTIONS = ["providers", "session", "csrf", "signin", "signout", "callback", "verify-request", "error", "_log"];
-const useConfig = () => useTypedBackendConfig(useRuntimeConfig(), "authjs");
+const useConfig = () => useTypedBackendConfig(useRuntimeConfig(), useRuntimeConfig().public.auth.provider.type ?? 'authjs');
const readBodyForNext = async (event) => {
let body;
if (isMethod(event, "PATCH") || isMethod(event, "POST") || isMethod(event, "PUT") || isMethod(event, "DELETE")) {
--
2.34.1
happening to me as well, using the Github provider
@mfreeman451 Did applying the patch fix your issues?
any news about this ?
any news about this ?
The topic got moved to https://github.com/sidebase/nuxt-auth/pull/490
No updates came from @zoey-kaiser after we last spoke. And it seems tyepescript restrictions prevent her from fixing the issue with minimal effort.
I've tried rectifying the problem on my own, but it requires an important restructuring of a few typed interfaces.
My suggestion, since this issue is taking way more time than needed to be fixed, is to patch it on your own.
If you are on github, and know how to (or ask someone with better experience).
It's a very easy fix, if you ignore auth.provider.type = 'authjs'
and any potential future updates.
Hi everyone! I had some more time to look into this and I feel like we may be dealing with three separate issues here!
1.) The original issue posted by @nikkorejz, had the issue that it was using the local
provider, but still created a NuxtAuthHandler, when the local
provider does not need, even is incompatible with it. In order to use the setup with the NuxtAuthHandler, the authjs
provider has to be selected.
2.) @Son-Isaki, you had another completely different error (Cannot access 'renderer$1' before initialization
) and your error log, does not reference any code used by NuxtAuth. If you are still facing this issue, please open a new issue to separate it from the other issues in here!
3.) @Eternal-Grace, we looked into your PR before, but after some further investigation, your patch in theory should not work. This is due to you, allowing the local provider to also be compatible with the NuxtAuthHandler, by removing the hard coded authjs
value in the type declaration. However, if the local provider is selected, this file would never be used/accessed, as it is purely for instances running authjs. Could you please open a new issue with the error you were getting and then outline how your fix, resolved it.
I will be closing this issue, as it became a bit messy. I outlined the three separate issues, that were combined in this one. Please open new issues for your problems and then we can discuss them there! I hope this will allow us to make some progress on your problems! 🥳
Environment
Linux
v18.15.0
3.3.2
2.4.1
yarn@1.22.19
vite
modules
,auth
,colorMode
,app
,runtimeConfig
nuxt-icon@0.4.0
,nuxt-headlessui@1.1.4
,@nuxtjs/color-mode@3.2.0
,@nuxtjs/tailwindcss@6.6.4
,@sidebase/nuxt-auth@0.6.0-beta.2
-
Reproduction
No response
Describe the bug
I want to add base cookies auth to my nuxt3 project
Install nuxt-auth
yarn add @sidebase/nuxt-auth
Manually append to package.json in
dependencies
section"next-auth": "^4.18.8",
Add to
nuxt.config.ts
auth: { provider: { type: 'local', }, }, ...