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

КОМЕНТАРІ • 39

  • @zyphr69
    @zyphr69 8 місяців тому

    Thank you very much i have been struggling with this from tomorrow u are an OG

  • @riyanali3667
    @riyanali3667 Рік тому +1

    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 🔥

  • @DanielOdu
    @DanielOdu Рік тому +1

    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.

  • @lemon3845
    @lemon3845 Рік тому

    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" :/

  • @AfonsoFilipeJr
    @AfonsoFilipeJr Рік тому

    Thanks mate 👍🏼

    • @KaiEx-lo1ll
      @KaiEx-lo1ll Рік тому +1

      Did the code worked for you?

  • @MDRakib-wi4mj
    @MDRakib-wi4mj Рік тому

    Thank you so much sir❤

  • @lionelarafat5360
    @lionelarafat5360 Рік тому

    Still face the problem when i go to register. please solve it.

  • @arslangurbuz9819
    @arslangurbuz9819 Рік тому

    Route GET /api/products not found

  • @neveriodev350
    @neveriodev350 Рік тому

    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

    • @bhaveshyadav6486
      @bhaveshyadav6486 Рік тому

      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

  • @amaanpk
    @amaanpk Рік тому

    👍

  • @adityakaustavdas6307
    @adityakaustavdas6307 Рік тому

    How can we automatically update the stock of a product after the order is placed and delivered successfully?

    • @KaiEx-lo1ll
      @KaiEx-lo1ll Рік тому +1

      Did the code worked for you?

    • @Hungryforlearning
      @Hungryforlearning Рік тому +1

      @@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

    • @adityakaustavdas6307
      @adityakaustavdas6307 Рік тому

      @@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: /

  • @Hungryforlearning
    @Hungryforlearning Рік тому +1

    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

  • @johndeer8405
    @johndeer8405 Рік тому

    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.

  • @TerryMitchell
    @TerryMitchell Рік тому

    Why did we have to come back to the third branch? Can we not make these changes if we've finished the course?

    • @codingwithabbas
      @codingwithabbas  Рік тому

      I have used next-connect in the third branch thats why.

    • @TerryMitchell
      @TerryMitchell Рік тому

      @@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?

    • @DipsNohawar
      @DipsNohawar Рік тому

      @@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.

    • @romualdhansen-roxell
      @romualdhansen-roxell Рік тому

      @@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.

    • @DipsNohawar
      @DipsNohawar Рік тому

      @@romualdhansen-roxell have you successfully deployed this project in new version ? if so can you share the repo thanks.

  • @sorincristianadam8363
    @sorincristianadam8363 Рік тому

    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

    • @sorincristianadam8363
      @sorincristianadam8363 Рік тому

      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

    • @sorincristianadam8363
      @sorincristianadam8363 Рік тому

      on the reviews from customers the user is undefined I cannot show his name or avatar

    • @DipsNohawar
      @DipsNohawar Рік тому

      @@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 ?

  • @lewiscastro579
    @lewiscastro579 Рік тому

    P R O M O S M 🤦

  • @utkarsh_katiyar
    @utkarsh_katiyar Рік тому

    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