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
I'm attempting to embed v3 into an Astro project (brand new project from Astro init) with the following in a admin.astro page:
<divid="app"></div><script>import{renderStudio,defineConfig}from'sanity';import{deskTool}from'sanity/desk';constconfig=defineConfig({plugins: [deskTool()],projectId: 'snow-dog',dataset: 'production',schema: {types: [{type: 'document',name: 'post',title: 'Post',fields: [{type: 'string',name: 'title',title: 'Title',},],},],},});// This assumes that there is a <div id="app"></div> node in the HTML structure where this code is executed.renderStudio(document.getElementById('app'),config);</script>
This will properly pull in Sanity, but I get Unknown network error attempting to reach snow-dog.api.sanity.io. Looking in my console, it's a CORS issue (Access to XMLHttpRequest at 'https://{project}.api.sanity.io/v2021-06-07/users/me?tag=sanity.studio.users.get-current' from origin 'http://localhost:3333' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.)
I've got CORS set up correctly in my project (see below)
Is there something else that needs to be done to get this to work?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm attempting to embed v3 into an Astro project (brand new project from Astro init) with the following in a
admin.astro
page:This will properly pull in Sanity, but I get
Unknown network error attempting to reach snow-dog.api.sanity.io
. Looking in my console, it's a CORS issue (Access to XMLHttpRequest at 'https://{project}.api.sanity.io/v2021-06-07/users/me?tag=sanity.studio.users.get-current' from origin 'http://localhost:3333' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
)I've got CORS set up correctly in my project (see below)
Is there something else that needs to be done to get this to work?
Beta Was this translation helpful? Give feedback.
All reactions