getStaticProps returns empty object at prod and dev (next v9.5.1) #15993
Bug reportDescribe the buggetStaticProps returns empty object at both dev and prod To ReproduceExpected behaviorReturned props should get passed to the component System information
Additional contextI dug through next-server.js and logged the related values: |
Replies: 15 comments 18 replies
|
Can you please check if the pageProps is passed correctly to the custom component export default ({ Component, pageProps }) => ( |
|
Hey @desaijay315 |
|
Why did this issue get converted to a discussion? |
|
The problem seems to be here: Component.getInitialProps is undefined so pageProps returns an empty object. Does this mean that getStaticProps doesn't actually pass props to getInitialProps in the custom app? |
|
Both appProps and pageProps are empty: |
|
useEffect just handles page views: |
|
Hello @desaijay315 |
|
@desaijay315 The issue is related to next-redux-wrapper library. It introduced new changes after Nextjs's latest features, their way of handling getStaticProps has changed, and since I only upgraded NextJs this issue occurred. The docs should mention this, and next-redux-wrapper should display a warning. Anyways, thanks for your time! |
|
That's great that you found the issue....Please mention the issue and also
let the Devs at Next.js know about it...they will upgrade the docs
…On Tue, 11 Aug 2020, 21:27 Omar Dulaimi, ***@***.***> wrote:
@desaijay315 <https://github.com/desaijay315> The issue is related to
next-redux-wrapper library. It introduced new changes after Nextjs's latest
features, their way of handling getStaticProps has changed, and since I
only upgraded NextJs this issue occurred.
The docs should mention this, and next-redux-wrapper should display a
warning.
Anyways, thanks for your time!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#15993 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACHKWYNQV5BT566NUTMZGXDSAFS6RANCNFSM4PYWRJPA>
.
|
|
I have this issue too, is this issue solved? Or we're waiting for next-redux-wrapper team's fix? |
|
facing the same issue and not getting the solution |
|
@wparam @usman786-ctrl As you can see, there's a warning on top of the page saying this: |
|
How did you solved this issue? Facing the same problem here |
|
I created the same issue in next.js but they moved it to discussions. Now finally can solve the problem. Thanks a lot @omar-dulaimi . |
|
Maybe you are calling the getStaticProps or getServerSideProps or getStaticPaths function from outside of pages or app directory (v-13). If you do that next js will send you an empty props object. |
@desaijay315 The issue is related to next-redux-wrapper library. It introduced new changes after Nextjs's latest features, their way of handling getStaticProps has changed, and since I only upgraded NextJs this issue occurred.
The docs should mention this, and next-redux-wrapper should display a warning.
Anyways, thanks for your time!