NextJS: Access has been blocked by CORS policy
You finally managed to get your Next.js-based JSS application loading in the Experience Editor, but then you start noticing intermittent errors and a crowded browser console error log. Let's address some of those issues.
Here are some of the errors you might see:
Add this to your
next.config.js file above or below
This should resolve most of your errors.
You may still see this one:
According to Sitecore, it doesn't affect content editing and it can be ignored. Sitecore says this error affects XP 10.1, but I am also seeing it in 10.2.
I'm also seeing this one, but no fix yet... I reached out to Sitecore support and they said that the related bug 463325 is still open as of 23 Nov, 2022.
Keep on BUIDLing,