You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to connect to visual editing in Sanity with Nuxt on Vercel #1053
I am encountering an issue with the Sanity visual editing tool in my Nuxt application hosted on Vercel. The error message displayed is:
PresentationTool-d136ce86.js:78 Unable to connect to visual editing. Make sure you've setup '@sanity/visual-editing' correctly
Version
@sanity/cli (global) 3.52.0 (latest: 3.54.0)
@sanity/code-input 4.1.4 (up to date)
@sanity/color-input 3.1.1 (up to date)
@sanity/eslint-config-studio 3.0.1 (latest: 4.0.0)
@sanity/hierarchical-document-list 2.0.0 (up to date)
@sanity/icons 3.3.1 (up to date)
@sanity/vision 3.54.0 (up to date)
sanity 3.54.0 (up to date)
I have the same problem reported by @lhoucinecherif . Compared to him I see the "401 invalid secret" error on the site page. But this problem occurs only if I publish on a Vercel Pro account. Using a Vercel Hobby the visual editing works perfectly (as well as in localhost).
I know that Vercel Pro has its own integration mechanism with Sanity, could this be interfering with the visual editing?
Activity
danielroe commentedon Sep 7, 2024
Are you sure you have configured all those environment variables correctly on Vercel?
jeffreyroulston commentedon Oct 9, 2024
Faced into this issue over the past day.
It occurs when you are trying to enable the preview mode from a seperate host due to the set-cookie header being
'SameSite=Lax'.To resolve this you need to create a server middleware to modify the set-cookie response header for the 307 redirect.
cookie.replace('SameSite=Lax', 'SameSite=None; Secure')Seems to be an issue also affecting Remix, but its related to the response headers
AldebaranPrimo commentedon Oct 22, 2024
I have the same problem reported by @lhoucinecherif . Compared to him I see the "401 invalid secret" error on the site page. But this problem occurs only if I publish on a Vercel Pro account. Using a Vercel Hobby the visual editing works perfectly (as well as in localhost).
I know that Vercel Pro has its own integration mechanism with Sanity, could this be interfering with the visual editing?