Coder Social home page Coder Social logo

Comments (4)

theodorusclarence avatar theodorusclarence commented on May 10, 2024

I've never had this problem before.

Do you have any middleware, or do you use any getStaticProps/getServerSideProps?

from ts-nextjs-tailwind-starter.

cha2hyun avatar cha2hyun commented on May 10, 2024

@theodorusclarence
Thanks for reply and amazing starter package 🙇‍♂️

Code (Middleware)

_app.tsx

/* eslint-disable @typescript-eslint/no-explicit-any */
import AOS from 'aos';
import { SessionProvider } from 'next-auth/react';
import React, { useEffect } from 'react';
import { QueryClient, QueryClientProvider } from 'react-query';

import '@/styles/aos.scss';
import '@/styles/globals.css';
import '@/styles/colors.css';

// !STARTERCONF This is for demo purposes, remove @/styles/colors.css import immediately

/**
 * !STARTERCONF info
 * ? `Layout` component is called in every page using `np` snippets. If you have consistent layout across all page, you can add it here too
 */

const MyApp = ({
  Component,
  pageProps: { session, ...pageProps },
}: {
  Component: any;
  pageProps: any;
}) => {
  const [queryClient] = React.useState(() => new QueryClient());

  // AOS animation
  useEffect(() => {
    AOS.init({
      once: true,
      duration: 500,
      easing: 'ease-out-cubic',
    });
  });

  return (
    // next-auth
    <SessionProvider session={session}>
      {/* infiniteScroll */}
      <QueryClientProvider client={queryClient}>
        {/* PageProps */}
        <Component {...pageProps} />

        {/* Debug Mode */}
        {/* import { ReactQueryDevtools } from 'react-query/devtools';
        <ReactQueryDevtools initialIsOpen={false} /> */}
      </QueryClientProvider>
    </SessionProvider>
  );
};

export default MyApp;

Production

site 1 : https://www.cue8949.com (deploy on AWS with docker)
didn't use any getStaticProps/getServerSideProps
using useInfiniteQuery from 'react-query' or Axios to fetch data from api.

site 2 : https://nangmanski-web-v2.vercel.app (deploy on Vercel)
using getServerSideProps to fetch data. it shows _error.tsx when it cant fetch data.

Problem

both site has same _404.tsx and _error.tsx and both site has same issue that can't reach to _404.tsx when user go to invalid url.

from ts-nextjs-tailwind-starter.

theodorusclarence avatar theodorusclarence commented on May 10, 2024

Can I see the code of the getServerSideProps?

I suspect it is because you catch all the routes for index with the getServerSideProps.

But I might be wrong; if you didn't, I think its best to open up an issue in the Next.js repository.

from ts-nextjs-tailwind-starter.

cha2hyun avatar cha2hyun commented on May 10, 2024

Thanks for help! 🙏

from ts-nextjs-tailwind-starter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.