rsnext/errors/invalid-redirect-gssp.md
JJ Kasper bc80fb4fb2
Add handling for redirects from getStaticProps/getServerSideProps (#16642)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2020-09-08 09:23:21 +02:00

701 B

Invalid Redirect getStaticProps/getServerSideProps

Why This Error Occurred

The redirect value returned from your getStaticProps or getServerSideProps function had invalid values.

Possible Ways to Fix It

Make sure you return the proper values for the redirect value.

export const getStaticProps = ({ params }) => {
  if (params.slug === 'deleted-post') {
    return {
      redirect: {
        permanent: true // or false
        destination: '/some-location'
      }
    }
  }

  return {
    props: {
      // data
    }
  }
}