Do you have Craft 3.4 installed?
And can you do a console.log inside the pages/api/preview.ts file, so that we can be sure, that the function gets called correctly?
And what do you get if you log the context variable inside the getStaticProps function?
Does it help to update to the newest Craft 3.4.16? (github.com/craftcms/cms/blob/maste...)
It adds CORS headers with a * so maybe that helps in your case.
@mark
Now I also had the problem that the Next.js frontend didn't update in the live preview. Then I deleted the cookies for the domain where Craft runs and suddenly it worked again... Very strange and at the moment I have no idea what went wrong with the cookies.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Do you have Craft 3.4 installed?
And can you do a console.log inside the
pages/api/preview.ts
file, so that we can be sure, that the function gets called correctly?And what do you get if you log the
context
variable inside the getStaticProps function?Yup! Running Craft 3.4.11. I've also upgraded Next to 9.3.4@canary mentioned in this Github issue: github.com/zeit/next.js/issues/112...
But when I access the preview page directly (from Craft's iFrame), it sends the correct context:
Thanks for the quick responses, Matthias!
Does it help to update to the newest Craft 3.4.16? (github.com/craftcms/cms/blob/maste...)
It adds CORS headers with a
*
so maybe that helps in your case.@mark
Now I also had the problem that the Next.js frontend didn't update in the live preview. Then I deleted the cookies for the domain where Craft runs and suddenly it worked again... Very strange and at the moment I have no idea what went wrong with the cookies.