👋 Next.js Conf 2024: Come build, party, run, and connect with us! See all events

CORS 403 errors with Sanity image URLs in canvas elements

10 replies
Last updated: Jun 6, 2024
Hello! Our team has been using sanity and webgl/canvas for several years but we've never run into this.
We're getting CORS 403 errors when placing Sanity image urls into a canvas element. Our origins for the project are set properly.
crossOrigin = 'anonymous'
on these images will not load the images in production, but standard images do work (see in sandboxes). We've never experienced this, Very open to recommendations to continue testing.
Minimal demo:
https://codesandbox.io/p/sandbox/test-sanity-cors-forked-g7jskz Production sandbox:
https://g7jskz-5173.csb.app/
Jun 6, 2024, 12:54 PM
Thanks for reporting. We’re currently investigating this. Out of curiosity, are you allowing credentials for this origin in sanity.io/manage ?
Jun 6, 2024, 5:08 PM
Not at current, it didn't seem to change in our testing, can enable if needed
Jun 6, 2024, 5:09 PM
They shouldn’t be necessary, but adding it may give you a work around for the time being.
Jun 6, 2024, 5:10 PM
Our prod domain (not shared in here) has credentials enabled and still shows the error
Jun 6, 2024, 5:14 PM
Thanks for checking.
Jun 6, 2024, 5:14 PM
Yep! Lmk if theres anything else I can check for us
Jun 6, 2024, 5:15 PM
Thanks. We’ve got the team on it!
Jun 6, 2024, 5:21 PM
We've received and verified a report of none of the images, canvas and otherwise loading either on our site (can DM), this is at least consistently images not loading, feel free to share
Jun 6, 2024, 5:22 PM
Can you DM me your site?
Jun 6, 2024, 5:26 PM
For posterity: this was fixed by a PR from our end.
Jun 6, 2024, 8:25 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?