Skip to content

[Bug]: Passed props from getServerSideProps() and getStaticProps() are undefined if navigating to the same route (Next.js: 13.4.13-13.4.19) #2292

@thevisioner

Description

@thevisioner

Summary

Passed props from getServerSideProps() and getStaticProps() are undefined if navigating to the same route. Tested with multiple versions of Next.js: 13.4.13-13.4.19 and only occurs when app is built with the Netlify plugin. The problem is not observed with Next.js 13.4.12.

A link to a reproduction repository

https://github.com/thevisioner/test-netlify-next-page-props-issue

Expected Result

Return values from getServerSideProps() and getStaticProps() are expected to be passed to the page component.

Actual Result

All passed props from getServerSideProps() and getStaticProps() are undefined in the page component ar client render stage.

Steps to reproduce

  1. Install project dependencies: npm i
  2. Using the Netlify CLI, run: netlify serve
  3. When the page is displayed, open any subpage, for example: /test
  4. Pay attention to the fact that initially all values are present
  5. Click on any presented link (goes to the same route)
  6. Pay attention to the fact that props are now undefined

Next Runtime version

4.40.1

Is your issue related to the app directory?

  • Yes, I am using the app directory

More information about your build

  • I am building using the CLI
  • I am building using file-based configuration (netlify.toml)

What OS are you using?

Windows

Your netlify.toml file

`netlify.toml`
[build]
  command = "npm run build"
  publish = ".next"

[[plugins]]
  package = "@netlify/plugin-nextjs"

Your public/_redirects file

`_redirects`
# Paste content of your `_redirects` file here

Your next.config.js file

`next.config.js`
/** @type {import('next').NextConfig} */
const nextConfig = {}

module.exports = nextConfig

Builds logs (or link to your logs)

Build logs
# Paste logs here

Function logs

Function logs
# Paste logs here

.next JSON files

generated .next JSON files
# Paste file contents here. Please check there isn't any private info in them
# You can either build locally, or download the deploy from Netlify by clicking the arrow next to the deploy time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugcode to address defects in shipped codev4Issues related to the v4 Next.js runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions