Contentful logo

Contentful Community

Problem with cached responses from Contentful

Hey, in our project we are using next.js and Contentful. I have a strange problem with responses from Contentful. In the code, I’m calling ‘getInitialProps’ method when rendering pages, and this method should get the latest Contentful state. Unfortunately, even tho there is new content, I don’t see it on the page. To see the changes in Contentful, I have to rebuild the app. I read (again) docs for Contentful and Nextjs and in theory, everything should work. As I understand, Contentful should invalidate the cache when new content is created. Also, getInitialProps method is catching current data. In our develop space, everything is working as expected. What I’m missing? Any ideas?

How is the Nextjs application hosted vercel, netlify etc I think you need to investigate there specifically if you have to rebuild the application for changes to take effect I have had issues before but their way more of a delay when the application rebuild before changes are reflected

1 Like