Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

165
Vistas
How to deploy React + Sanity app to Netlify

I currently worked on a Portfolio web application built using React and Sanity.io. After deploying to Netlify, all content in the Sanity was not showing.

Please, what am I not doing right?

I noticed I was getting this error message in the console:

Access to XMLHttpRequest at 'https://lyg8hs82.apicdn.sanity.io/v2022-02-01/data/query/denscholar?query=*%5B_type%20%3D%3D%20%22works%22%5D' from origin 'http://localhost:3001' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Code from my clien.j file

export const client = sanityClient({
    projectId: process.env.REACT_APP_SANITY_PROJECT_ID,
    dataset: 'denscholar',
    useCdn: true,
    apiVersion: '2022-02-01',
    token: process.env.REACT_APP_SANITY_TOKEN

})

const builder = imageUrlBuilder(client);

export const urlFor = (source) => builder.image(source)

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I guess you didn't add a CORS Origin to your newly deployed website.

Here do these steps:

1st go to your Sanity project. Then go to your API Settings. There you can add your newly deployed URL

sanityDashboard

After clicking on "Add CORS Origin"

Enter the url of your newly deployed site.

sanityAddCORSOrigin

After that, try to reload the deployed website. You shouldn't get any errors this time.

Glad if this helps.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda