nextjs
migration_error
ai_generated
true
Error: 'getServerSideProps' is not supported in app/ directory
ID: nextjs/getserversideprops-export
92%Fix Rate
92%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 14 | active | — | — | — |
Root Cause
Pages Router API used in App Router. getServerSideProps doesn't exist in app/ directory.
genericWorkarounds
-
95% success In App Router, make the component async and fetch data directly at the top level
export default async function Page() { const data = await fetch('...'); return <div>{data}</div>; }Sources: https://nextjs.org/docs/app/building-your-application/data-fetching
-
88% success Use generateMetadata for metadata and generateStaticParams for static paths
Use generateMetadata for metadata and generateStaticParams for static paths
Sources: https://nextjs.org/docs/app/api-reference/functions/generate-metadata
Dead Ends
Common approaches that don't work:
-
Move the file back to pages/ directory
60% fail
Defeats the purpose of migrating to App Router
-
Rename getServerSideProps to something else
85% fail
It's the function pattern that's unsupported, not just the name
Error Chain
Frequently confused with: