Next.js 13 Full Stack E-commerce App #33 | Fix Next-Connect Error, App Router for API
Вставка
- Опубліковано 16 чер 2023
- Checkout my In-Depth Next.js Masterclass on Udemy Courses:
www.udemy.com/course/nextjs-b...
Next.js Authentication with Next-Auth:
• Next.js Authentication...
================================================================
⚙️ Gadgets I use for Recording:
💻 Laptop - Macbook PRO M1 - 16/512
amzn.to/4eUqrSe
🎤 MIC - Samson Technologies Q2U USB/XLR Dynamic Microphone
amzn.to/3W9Z4wl
🖱️Mouse - Logitech G402 Gaming Mouse Hyperion Fury USB, Black
amzn.to/3RY4xUy
⌨️ Keyboard - Logitech K380 Multi-Device Bluetooth Keyboard
amzn.to/3RY4Fn0
🖥️ Monitor - UltraSharp 24-Inch Screen Led-Lit Monitor (U2419H)
amzn.to/4bxidN6
================================================================
Welcome to the 33rd episode of our Next.js 13 Full Stack E-commerce App series! In this video, we tackle a common issue related to the Next-Connect error in Next.js 13.4 and implement the App Router for API functionality.
Make sure to like this video, subscribe to our channel, and hit the notification bell to stay updated with the latest episodes in this series. Leave a comment if you have any questions or suggestions. We appreciate your support and look forward to seeing you in the next video!
#NextJS13 #FullStackEcommerce #AppRouterAPI
Thank you very much i have been struggling with this from tomorrow u are an OG
Thank you sooo much sir 😭💕
I have troubled with this error from the past 1 week and now it's solved coz of you only
Once again thank you so much 🔥
Get requests are working and are protected by user session but address post requests cannot access session data and return null. Im getting [CLIENT_FETCH_ERROR] when trying to add new address.
Hey Abbas love your tutorials, quick question, how handle the errors.js in the backend middlewares folder with the new next-connect version? having a hard time getting any other response than "Internal server Error" :/
Thanks mate 👍🏼
Did the code worked for you?
Thank you so much sir❤
Did the code worked for you?
Still face the problem when i go to register. please solve it.
Route GET /api/products not found
Hello Sir, I have a question
const Homepage = async({searchParams}) => {
const productsData = await getProducts(searchParams);
return
}
if i do
const Homepage = async(searchParams) => {
const productsData = await getProducts(searchParams);
return
}
I get something like this { params: {}, searchParams: { page: '1', max: '15' } }
how did we get this object here?
i'm a beginner
its because of destructuring syntax when you do it the second way you are just getting a parameter and if you do like
const Homepage = async(fetchedParams) => {
const {searchParams} = fetchedParams
}
then your error will be gone
👍
Did the code worked for you??
How can we automatically update the stock of a product after the order is placed and delivered successfully?
Did the code worked for you?
@@KaiEx-lo1ll when you start this project ..then you'll face lots of bugs for using of old version..but end of the day you can learn lots of things in this project
@@KaiEx-lo1ll I am getting an error when I try building it locally. any help is appreciated.
Generating static pages (20/22)
Error occurred prerendering page
Build error occurred
Error: Export encountered errors on following paths:
/admin/products/[id]/page: /admin/products/[id]
/admin/products/page: /admin/products
/page: /
how can i solve this problem..? this problem in 15 number video . please give us solution..i spend 3 days , but stile i can't solve this problem.. please help us ...sir
const session = await getSession({ req })
i'm not getting session what should i do
me too
@@mdminhajulislam3023 I solved this problem.
I commented on this in video #15
Greetings I appreciate the effort but it was clear something was wrong when you said we would use the app directory but you still used the pages directory outside of the app dir which defeats the purpose of the app directory. This project should have been built in the regular next js pages dir without the app router/dir. Unfortunately A beginner will not be able to make ALL the adjustments necessary to bring this project to production.
Why did we have to come back to the third branch? Can we not make these changes if we've finished the course?
I have used next-connect in the third branch thats why.
@@codingwithabbas But it's present in every branch, it's a little confusing as to why we have to go back to a branch that, for most of us who were building the app from the ground up, doesn't exist in our repo - can we not just apply the changes to our final version?
@@TerryMitchell thats what i wanna know can we build and deploy while keeping the older version of next-connect ? otherwise we have to do this change for every api route.
@@DipsNohawar since version 13.2 of nextJs there are a lot of changes on the api side, and all the api routes, as well as the controllers must be reviewed.
for me next-connect is no longer necessary (in the current version)
in the controllers we should no longer have (res, req, next) but only request and context, since the response is now done by NextResponse.
@@romualdhansen-roxell have you successfully deployed this project in new version ? if so can you share the repo thanks.
Hello Abbas, I have encountered few issues which I really need support into this, first is that I have to solve the stripe webhook to make it listen online like hosting endpoint, second when I am editing the products as an admin is not updated on the app, I have to redeploy the app to update the products for e.g , the thing with the review isn't working properly, the user cannot update his review and i need also to refresh the page so the form gets filled with the datas from the DB .. and last thing is the cloudinary with multer isn't working to upload images after I deployed the app it says that cannot find the public/uploads folder... Please let me know what kind of details you need so we can figure it out together thanks in advance
UPDATE: I fixed the stripe webhook hosting now the orders are working. I cannot make cloudinary and multer working after i deploy the app neither for avatar neither for product images and the filters for price and ratings are NOT working
on the reviews from customers the user is undefined I cannot show his name or avatar
@@sorincristianadam8363 i fixed the review to show user name and avatar you can see my comment on that video.
can you tell my how did you fix stripe webhook to listen to checkout.sesson.completed event all the time ? even if its not running on our command line ?
P R O M O S M 🤦
Getting this error after Next-Router Fix that you mentioned :
- error unhandledRejection: Error [MongooseServerSelectionError]: connect ECONNREFUSED ::1:27017
at _handleConnectionErrors (/Users/utkarshkatiyar/Documents/Github/zenshop/node_modules/mongoose/lib/connection.js:792:11)
at NativeConnection.openUri (/Users/utkarshkatiyar/Documents/Github/zenshop/node_modules/mongoose/lib/connection.js:767:11) {
digest: undefined