notFound
Unanswered
Scissor-tailed Flycatcher posted this in #help-forum
Scissor-tailed FlycatcherOP
Error: The default export of notFound is not a React Component in edit
at async Promise.all (index 0)
at async Promise.all (index 0)
at async Promise.all (index 0)
at async Promise.all (index 0)
I got like above. why? Below is my code.
import { notFound } from 'next/navigation';
----
user = await response.json();
if(!user) {
notFound();
}
-----
at async Promise.all (index 0)
at async Promise.all (index 0)
at async Promise.all (index 0)
at async Promise.all (index 0)
I got like above. why? Below is my code.
import { notFound } from 'next/navigation';
----
user = await response.json();
if(!user) {
notFound();
}
-----
27 Replies
Scissor-tailed FlycatcherOP
Thanks for your reply.
I was going to use notFound in next/navigation.
Now I selected other method so it seems like fixed.
If any question, will let you know.
Thanks for you reply again
I was going to use notFound in next/navigation.
Now I selected other method so it seems like fixed.
If any question, will let you know.
Thanks for you reply again
@rithul np, glad it's fixed :)
Scissor-tailed FlycatcherOP
thanks.
Are you expert in Next.js?
Are you expert in Next.js?
@rithul Can you help me?
one second
@Scissor-tailed Flycatcher Click to see attachment
your server is sending an HTML output when your client is expecting a JSON output
Scissor-tailed FlycatcherOP
I know that as well.
But I didn't reason yet
as you can see above image, I sent json style
It's strange
@Scissor-tailed Flycatcher Click to see attachment
put the api route in
src/pages not pagesyou must use
src for both pages and app, or not use src for bothAsian paper wasp
1. Fetching your own API route is not a good idea. Generally, you want to query the DB directly in Page.
2. Call the API in Postman, make sure it is actually returning the expected response. I suspect it is returning the 404 page
2. Call the API in Postman, make sure it is actually returning the expected response. I suspect it is returning the 404 page
@joulev put the api route in `src/pages` not `pages`
Scissor-tailed FlycatcherOP
thanks for your reply.
I followed as your guide, but it doesn't work yet.
Sad
I followed as your guide, but it doesn't work yet.
Sad
see mwskwong's message above
don't call your own api route
Scissor-tailed FlycatcherOP
You meant this?
I don't understand this well
what is prisma? and what do we in prisma?
I don't see content of prisma.
I don't see content of prisma.
Scissor-tailed FlycatcherOP
This is page for user edit.
This is my own api for getting user by ID
This is current bug
This is the result image
As you can see, I don't get user date