question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

404 Not Found with getServerSideProps

See original GitHub issue

I follow https://www.serverless.com/plugins/serverless-nextjs-plugin this article to run project nextjs, i18next-next. But all good with getStaticProps, with getServerSideProps I have error This side not found in production

My configure serverless.yml

willink-web:
  component: '@sls-next/serverless-component@latest'
  inputs:
    minifyHandlers: true
    logLambdaExecutionTimes: true
    useServerlessTraceTarget: true
    build:
      postBuildCommands: ['node scripts/post-build.js']
    memory:
      defaultLambda: 1024
      apiLambda: 1024
      imageLambda: 1024
    runtime:
      defaultLambda: 'nodejs14.x'
      apiLambda: 'nodejs14.x'
      imageLambda: 'nodejs14.x'
    timeout:
      defaultLambda: 20
      apiLambda: 15
      imageLambda: 15
    name:
      defaultLambda: 'penrag8-el7ggmc'
      apiLambda: 'penrag8-el7ggmc'
      imageLambda: 'penrag8-el7ggmc'
    bucketName: 'penrag8-k5q73ne'
    cloudfront:
      #   # if you want to use an existing cloudfront distribution, provide it here
      distributionId: E3NNVQYBUILHBD
      # this is the default cache behaviour of the cloudfront distribution
      # the origin-request edge lambda associated to this cache behaviour does the pages server side rendering
      defaults:
        forward:
          headers:
            [
              CloudFront-Is-Desktop-Viewer,
              CloudFront-Is-Mobile-Viewer,
              CloudFront-Is-Tablet-Viewer,
            ]
      # this is the cache behaviour for next.js api pages
      api:
        minTTL: 10
        maxTTL: 10
        defaultTTL: 10

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

2reactions
dphangcommented, Jul 31, 2021

@tranthaison1231 I am closing this issue as it should be fixed; the related PR should also try to automatically any default required files so postBuildCommands are not needed, unless you have a custom path/config, in which case you will need to write your own script

0reactions
tranthaison1231commented, Jul 31, 2021

Thank you so much

Read more comments on GitHub >

github_iconTop Results From Across the Web

Next.js, redirect to 404 page inside getServerSideProps
The notFound boolean allows the page to return a 404 status and 404 Page. export async function getServerSideProps(context) { const placeId ...
Read more >
How to return a 404 error in getServerSideProps with Next.js
Ever wondered how to redirect to a 404 error in getServerSideProps with Next.js? Follow our guide for the simples solution we've found!
Read more >
res.statusCode=404 in getServerSideProps results in ... - GitHub
So the current behaviour is: if I request /my-route I get a 404 http status code and the rendered 404 page; if I...
Read more >
Problem of 404 when using "getServerSideProps" - Support
Hello, I'm using “getServerSideProps” for a page and I get a 404 error on it. I've seen on this page that I need...
Read more >
Data Fetching: getServerSideProps - Next.js
The notFound boolean allows the page to return a 404 status and 404 Page. With notFound: true , the page will return a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found