πŸ‘€ Our most exciting product launch yet πŸš€ Join us May 8th for Sanity Connect

Vercel / Nextjs - How to Grant Access to Vercel

3 replies
Last updated: Aug 12, 2022
I have a project that displays and pulls data perfectly fine in localhost but when I go to deploy via vercel / nextjs it is finding the data as undefined because it doesn't have permission to access the API. How would I grant access to vercel if the deployment stage doesn't have an accessible URL in the format of: protocol://hostname [:port] ?
Aug 12, 2022, 7:25 PM
A few things to check here:1. If your dataset is private you will need to use a token when querying.
2. You can add your vercel domain to your CORS origins like this:
https://*.<http://vercel.app|vercel.app>
Aug 12, 2022, 7:31 PM
I got it working, thank you. I apparently had the server, vercel, and API setup working fine, but I had to predefine each part of my groq query before I returned it in my JSX. Just took a little experimentation. I appreciate the help, thank you πŸ™‚
Aug 12, 2022, 7:53 PM
Awesome! Glad you got it working!
Aug 12, 2022, 8:09 PM

Sanity– build remarkable experiences at scale

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

Was this answer helpful?