dashboard tutorial chapter 15 problem
Unanswered
White Swiss Shepherd Dog posted this in #help-forum
White Swiss Shepherd DogOP
I'm doing chapter 15 (authentication) and up to now everything went smoothly. But now when I try to login I get an internal server error 500:
I've checked all the code and it's exactly the same as it appears in the tutorial. I've set up the environment variable correctly and the web browser shows an error that says
I've posted the whole error in this pastebin link as it appears in the web browser console: https://pastebin.com/FFqsv3nD
[Error: function Error() { [native code] }] { digest: '3581910565' }
POST /login?callbackUrl=http%3A%2F%2Flocalhost%3A3000%2Fdashboard 500 in 1077ms
I've checked all the code and it's exactly the same as it appears in the tutorial. I've set up the environment variable correctly and the web browser shows an error that says
[ Server ] Error: function Error() { [native code] }
91 | }
92 |
> 93 | export async function authenticate(
| ^
94 | prevState: string | undefined,
95 | formData: FormData,
96 | ) {
I've posted the whole error in this pastebin link as it appears in the web browser console: https://pastebin.com/FFqsv3nD
24 Replies
American
Can you paste your LoginForm?
White Swiss Shepherd DogOP
Sure, this is it https://pastebin.com/yrLKe2kh
American
Looks good to me. Is /login a route or a page?
White Swiss Shepherd DogOP
It's a page /login/page.tsx
import AcmeLogo from "@/app/ui/acme-logo";
import LoginForm from "@/app/ui/login-form";
import { Suspense } from "react";
export default function LoginPage() {
return (
<main className="flex items-center justify-center md:h-screen">
<div className="relative mx-auto flex w-full max-w-[400px] flex-col space-y-2.5 p-4 md:-mt-32">
<div className="flex h-20 w-full items-end rounded-lg bg-blue-500 p-3 md:h-36">
<div className="w-32 text-white md:w-36">
<AcmeLogo />
</div>
</div>
<Suspense>
<LoginForm />
</Suspense>
</div>
</main>
);
}
American
Can you share the file the
authenticate
lives in too?American
Can't really tell see what would be wrong, but I don't know next-auth
Oh, because you're re-throwing it?
White Swiss Shepherd DogOP
I did
throw Error
rather than throw error
American
Ah, I see
White Swiss Shepherd DogOP
Man that was hard to find
Thanks for the help though 🙂
@White Swiss Shepherd Dog I'm doing chapter 15 (authentication) and up to now everything went smoothly. But now when I try to login I get an internal server error 500:
[Error: function Error() { [native code] }] { digest: '3581910565' }
POST /login?callbackUrl=http%3A%2F%2Flocalhost%3A3000%2Fdashboard 500 in 1077ms
I've checked all the code and it's exactly the same as it appears in the tutorial. I've set up the environment variable correctly and the web browser shows an error that says
[ Server ] Error: function Error() { [native code] }
91 | }
92 |
> 93 | export async function authenticate(
| ^
94 | prevState: string | undefined,
95 | formData: FormData,
96 | ) {
I've posted the whole error in this pastebin link as it appears in the web browser console: https://pastebin.com/FFqsv3nD
Do you want to know why you’re gettin this format?
[Error: {something : XXXX }] { digest : XXXXXX }
[Error: {something : XXXX }] { digest : XXXXXX }
It happens because Next.js doesn’t want to send to the client the actual unhandled error that happened inside a Server Action to avoid sensitive info leak.
Anytime you see that pattern, the problem is in the Server Action, not the component calling the server action.
Just a little Heads up maybe helps you finding the issue the next time you encounter it!
Anytime you see that pattern, the problem is in the Server Action, not the component calling the server action.
Just a little Heads up maybe helps you finding the issue the next time you encounter it!
White Swiss Shepherd DogOP
Thanks! That is very helpful to know 🙂
Glad to help 😉
White Swiss Shepherd DogOP
You wouldn't be from Spain, would you? Your family name is a town in the area I'm from
White Swiss Shepherd DogOP
Well, it's a very nice surname 🙂
This is the city, I was actually there last January https://es.wikipedia.org/wiki/Llanes
Haha thank you, didn’t know it was common in Spain, it’s def not common here. Anyway we shouldn’t polluting this thread 🤭
White Swiss Shepherd DogOP
yeah, you're right XD