Next.js Deployed on Vercel Now - Dynamic Links Return 'An Unexpected Error has Occurred'

12 replies
Last updated: May 9, 2020
Hello. I followed the Next.js tutorial, deployed on Now, the dynamic links renders
An unexpected error has occurred.
May 9, 2020, 8:39 AM
Here’s what I did: Cloned the repo for the tutorial: https://github.com/sanity-io/tutorial-sanity-blog-react-next
May 9, 2020, 8:40 AM
Followed the steps in the readme file. Including deployment to Now.
May 9, 2020, 8:40 AM
Currently deployed to: https://testbug.now.sh
May 9, 2020, 8:41 AM
I’ve not changed any of the code in the repo, other than following the instructions in the readme. I added some comments to the index page.
May 9, 2020, 8:41 AM
I tried including a hardcoded link to the page the dynamic link points to – that works.
May 9, 2020, 8:42 AM
Like I said, the blog article page shows
An unexpected error has occurred.
Refreshing the page renders the page fine.
May 9, 2020, 8:43 AM
Have you added https://testbug.now.sh to the CORS settings in manage.sanity.io ?
May 9, 2020, 8:43 AM
Let’s see. I ran:
sanity cors add <http://localhost:3000> --no-credentials
May 9, 2020, 8:43 AM
But of course I need to add the remote site too…
May 9, 2020, 8:44 AM
Yeah, try that. I think that will fix it
May 9, 2020, 8:44 AM
It does. Thanks very much!
May 9, 2020, 8:45 AM
Coolio!
May 9, 2020, 8:46 AM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Categorized in