👀 Our most exciting product launch yet 🚀 Join us May 8th for Sanity Connect

Issue with burger menu not appearing after deploying site on Vercel.

8 replies
Last updated: Oct 10, 2023
Hello.I have been trying to find a solution for this. I have inherited a site based on
sanity.io and nextJs. The current navigation was hardcoded and I have made the navigation on sanity using schema. Navigation appears in a burger menu. Everything is working fine in the dev. But as soon as I deploy the site on vercel, the burger menu is empty.After deploying with vercel, I am getting this Network error :
Network error while attempting to reach https://....
While there is no such error in the dev.
Thanks in advance.
Sep 21, 2022, 9:25 AM
Is the domain listed in cors origins in Sanityo.io/manage ?
Sep 21, 2022, 10:08 AM
Yes it is. However, when I check the vercel link from CORS origins in sanity, I see my sanity menu.But in vercel deployments from my latest commits on bitcucket, the menu is not there. I also dont see the menu when I deploy the website.
I am sorry, I am a new developer so there are a lot of things that I am still trying to figure out.
Sep 21, 2022, 10:28 AM
It sounds like when you deploy, your site is not longer able to connect to Sanity. There are a few reasons this happens:1. As
user S
mentioned, your CORS origins aren't properly added to sanity.io/manage .2. You're using a token and it's not properly picked up once you deploy.
Sep 21, 2022, 3:22 PM
Another possibility is that your navigation component is rendering before it has data from Sanity, which often doesn’t show itself in development but rears its head in production.
Sep 21, 2022, 8:00 PM
Hello again. Thank you for your reply. I have tried and tested, so far I believe its not CORS or token problem because this is a big website and all the other pages are rendered succesfully.I belive its problem with my component rendering. When the website runs, I get an empty Navigation array twice, and its the third time that I get navigation items in the array.
I have been playing with useEffect but still not able to solve the issue.
attaching the code snippet below.
Thanks in advance.
Sep 22, 2022, 8:40 AM
I have solved this issue. Thank you all for your msgs. Really helped alot. 🙏
Sep 22, 2022, 10:41 AM
Glad you got it sorted out!
Sep 22, 2022, 3:08 PM
user S
can you please tell how you solved the issue? I'm having the same right now.
Oct 10, 2023, 8:10 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?