Skip to content
This repository has been archived by the owner on Apr 7, 2023. It is now read-only.

Catching error: You can not use getInitialProps with getServerSideProps #11

Open
mkhoussid opened this issue Oct 8, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@mkhoussid
Copy link

Reproducible repo

Clone repo and run yarn and then npm run dev.

Error during compile time:

error - unhandledRejection: Error: You can not use getInitialProps with getServerSideProps. Please remove getInitialProps. 

Removing getServerSideProps from pages/index.tsx resolves the issue, but this obviously isn't a solution.

Any ideas what's going on?

@lkostrowski
Copy link

lkostrowski commented Dec 17, 2021

Under the hood this lib uses getInitialProps, next obviously doesnt allow it since getSErverSideProps is a successor of the old one. Api-wise its harder (for effector) to user getServerSideProps because it has to be a module export, not a HOC, but possibly its doable (by wrapping module?)

Some features you can achieve since withStart<PageContext>() is giving you access to request object, but indeed it can't be used further due to limited redirection possibilities... Maybe some hacking

So it makes sense to try to make something less magical based on getServerSideProps...
Other thing is that you can still use getInitialProps

I just figured it out and TBH I can't use this package on production - its too risky going against next's direction

@sergeysova sergeysova added the bug Something isn't working label Aug 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants