app-generator / rocket-nextjs

Rocket Nextjs - by AppSeed
https://rocket-nextjs-demo.vercel.app
9 stars 3 forks source link

Email Confirmation Link - Bumps Error #8

Closed app-generator closed 9 months ago

app-generator commented 9 months ago

With correct SMTP settings, the confirmation email is sent but on click, the UI bumps exception:

@topstar210 please take a look.

TY!


Confirmation link:

http://localhost:3000/api/auth/callback/email?callbackUrl=http%3A%2F%2Flocalhost%3A3000%2Fregister&token=0a3adfcfbf0f64f57febb336bffae797205ae39462ef2ff39dd250c94b0a9807&email=testme%40appseed.us



Ui Error

image



Runtime Log

https://next-auth.js.org/warnings#no_secret
[next-auth][error][CALLBACK_EMAIL_ERROR]
https://next-auth.js.org/errors#callback_email_error "ikm" must be at least one byte in length {
  message: '"ikm" must be at least one byte in length',
  stack: 'TypeError: "ikm" must be at least one byte in length\n' +
    '    at normalizeIkm (webpack-internal:///(rsc)/./node_modules/@panva/hkdf/dist/node/cjs/index.js:25:32)\n' +
    '    at hkdf (webpack-internal:///(rsc)/./node_modules/@panva/hkdf/dist/node/cjs/index.js:46:60)\n' +
    '    at getDerivedEncryptionKey (webpack-internal:///(rsc)/./node_modules/next-auth/jwt/index.js:80:36)\n' +
    '    at Object.encode (webpack-internal:///(rsc)/./node_modules/next-auth/jwt/index.js:34:36)\n' +
    '    at Object.callback (webpack-internal:///(rsc)/./node_modules/next-auth/core/routes/callback.js:238:44)\n' +
    '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
    '    at async AuthHandler (webpack-internal:///(rsc)/./node_modules/next-auth/core/index.js:202:38)\n' +
    '    at async NextAuthRouteHandler (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:50:30)\n' +
    '    at async NextAuth._args$ (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:85:24)\n' +
    '    at async D:\\work\\repo-rocket\\rocket-nextjs\\node_modules\\next\\dist\\compiled\\next-server\\app-route.runtime.dev.js:6:62609',
  name: 'TypeError'
}
 ○ Compiling /login ...
 ✓ Compiled /login in 1040ms (1248 modules)
[next-auth][warn][NO_SECRET]
https://next-auth.js.org/warnings#no_secret
 ⨯ TypeError: "ikm" must be at least one byte in length
    at normalizeIkm (webpack-internal:///(rsc)/./node_modules/@panva/hkdf/dist/node/cjs/index.js:25:32)
    at hkdf (webpack-internal:///(rsc)/./node_modules/@panva/hkdf/dist/node/cjs/index.js:46:60)
    at getDerivedEncryptionKey (webpack-internal:///(rsc)/./node_modules/next-auth/jwt/index.js:80:36)
    at Object.encode (webpack-internal:///(rsc)/./node_modules/next-auth/jwt/index.js:34:36)
    at Object.callback (webpack-internal:///(rsc)/./node_modules/next-auth/core/routes/callback.js:356:36)
    at async AuthHandler (webpack-internal:///(rsc)/./node_modules/next-auth/core/index.js:298:38)
    at async NextAuthRouteHandler (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:50:30)
    at async NextAuth._args$ (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:85:24)
    at async D:\work\repo-rocket\rocket-nextjs\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:62609
topstar210 commented 9 months ago

I can't confirm this. working all in my side

app-generator commented 9 months ago

This happens when the .env uses an empty NEXTAUTH_SECRET=

@topstar210 please handle this use case using a descriptive runtime log.

TY!

topstar210 commented 9 months ago

Fixed no_secret issue is only detected on https So if a user have this issue, he can see error page that contain server error message But the users would be never see this issue with exact server setting when deploy the project :) Actually, this error message is for devops :)

app-generator commented 9 months ago

Closing. TY @topstar210