The DocumentContext is undefined in Fastly when you use getServerSideProps. As soon as you get rid of it, it works as expected.
- Clone this repo
- Install dependencies:
npm install - Run in dev mode:
npm run dev - Go to http://localhost:3000 and notice that the context is shown
- Run in production mode:
npm run build && npm run start - It's still working
- Run with Fastly:
npm run fastly-serve - Go to http://localhost:7676 and notice the context is missing
- If you comment out the
getServerSidePropsfromindex.tsx, it will show the context.
There are properties on the DocumentContext like locale that are quite useful in situations where you need it to only render on the server.