#anyone using next auth and getting this

1 messages · Page 1 of 1 (latest)

austere schooner
#

try import crypto from 'crypto';

craggy sinewBOT
#

Hi @austere schooner. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Sorry @austere schooner, I seem to be having a bit of trouble. Don't worry though, I've pinged my supprt and they will try to fix me up! :technologist:

Perhaps try again in 15mins?

still zealot
#

to generate a JWT token

austere schooner
#

where or how is it generated?

still zealot
#
  Error during SSR Rendering
  error rendering: Error: crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported

  Debug info:
  - error rendering: Error: crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported
        at rng (node_modules/uuid/dist/esm-browser/rng.js:14:13) [C:\Users\kaako\Desktop\vs-code\studends-sis-2\.next\server\app\chunks\ssr\_63184c._.js:234387:19]
        at v4 (node_modules/uuid/dist/esm-browser/v4.js:6:51) [C:\Users\kaako\Desktop\vs-code\studends-sis-2\.next\server\app\chunks\ssr\_63184c._.js:234406:191]
        at Object.encode (node_modules/next-auth/jwt/index.js:52:72) [C:\Users\kaako\Desktop\vs-code\studends-sis-2\.next\server\app\chunks\ssr\_63184c._.js:222150:76]
        at async Object.callback (node_modules/next-auth/core/routes/callback.js:432:22) [C:\Users\kaako\Desktop\vs-code\studends-sis-2\.next\server\app\chunks\ssr\_63184c._.js:224448:26]
        at async AuthHandler (node_modules/next-auth/core/index.js:302:28) [C:\Users\kaako\Desktop\vs-code\studends-sis-2\.next\server\app\chunks\ssr\_63184c._.js:224832:38]
        at async NextAuthRouteHandler (node_modules/next-auth/next/index.js:68:28) [C:\Users\kaako\Desktop\vs-code\studends-sis-2\.next\server\app\chunks\ssr\_63184c._.js:224943:30]
        at async NextAuth._args$ (node_modules/next-auth/next/index.js:103:16) [C:\Users\kaako\Desktop\vs-code\studends-sis-2\.next\server\app\chunks\ssr\_63184c._.js:224977:24]
        at async (node_modules/next/dist/server/future/route-modules/app-route/module.js:248:37) [C:\Users\kaako\Desktop\vs-code\studends-sis-2\.next\server\app\chunks\ssr\_63184c._.js:207794:37]
austere schooner
#

any code related?

still zealot
#
import CredentialsProvider from "next-auth/providers/credentials";
import NextAuth from "next-auth";
import type { NextAuthOptions } from "next-auth";
import { createClient } from "@supabase/supabase-js";

const supabase = createClient(process.env.SUPABASE_URL || "", process.env.SUPABASE_KEY || "")

const authOptions: NextAuthOptions = {
  // Configure one or more authentication providers
  providers: [
    // ...add more providers here
    CredentialsProvider({
      // The name to display on the sign in form (e.g. "Sign in with...")
      name: "Credentials",


      credentials: {
        username: {
          label: "Username",
          type: "text",
          placeholder: "jsmith",
        },
        password: {
          label: "Password",
          type: "password",
        },
      },
      async authorize(credentials, req) {
        const { username, password } = credentials as any;
      

        const { data, error } = await supabase.from("tb_students_info").select("*").eq("username", username).eq("password", password)
        const data1  = await supabase.from("tb_students_info").select("*")

        if (!data && error || data && data.length === 0) {
          return null
        } else {
          return data[0] as any
        }
      },
    }),
  ],

  callbacks: {
    async jwt({ token, user }) {
      return { ...token, ...user };
    },
    async session({ session, token, user }) {
      session.user = token;

      return session;
    },
  },

  pages: {
    signIn: "/",
  },
};

const handler = NextAuth(authOptions)
export { handler as GET, handler as POST }
#

here @austere schooner

austere schooner
#

looks the same as mine tbh

still zealot
#

oh man i'm having this issue with all my repo's somehow

still zealot
austere schooner
#

check ur node and npm version maybe

still zealot
still zealot
austere schooner
#

18.16.0

still zealot
#

ok, thank you!

austere schooner
#

do you use the nvm package?

#

could just use nvm use v18

still zealot
#

it's v18.12.1 already

#

using yarn

#
dependencies": {
    "@headlessui/react": "^1.7.14",
    "@supabase/supabase-js": "^2.21.0",
    "@types/node": "^20.0.0",
    "@types/react-dom": "^18.0.0",
    "axios": "^1.4.0",
    "next": "latest",
    "next-auth": "^4.22.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-toastify": "^9.1.2",
    "tailwindcss": "^3.3.2"
  },
#

my pacakges

austere schooner