CORS error with Identity Widget on deployed website

Hi there,

I’ve recently built a portfolio website with Astro and I’ve implemented Netlify CMS using the custom configuration mentioned on the docs and it works as intented. However, I’m running into an issue where the identity widget is displaying a CORS issue in the console:

Access to script at '' 
from origin '' 
has been blocked by CORS policy: 
No 'Access-Control-Allow-Origin' header is present on the requested resource.

I’ve tried resetting the Git Gateway and no dice. Any ideas on how to solve the issue? Thanks in advance!

Hi @DeviousLab , thanks for posting and welcome to the Netlify Support Forum. Sorry you are getting the cors error with Astro.

Regarding your issue, note that regular scripts in Astro get compiled into modules and that’s why you’re seeing a CORS error. Kindly use the script below instead for adding the Netlify Identify Widget to see if it works.

<script is:inline src=""></script>

For more information about the Script & Style Directives visit the link at Template Directives Reference 🚀 Astro Documentation

Let me know if the suggested solution works. Thanks.

Hi there! Thanks for your interest in Netlify CMS. Looks like you posted your question a little while ago, but that you haven’t received a solution yet. Here’s where you might get more help: - the site houses our extensive documentation that likely contains helpful information to get you back on track.

netlify cms slack - join our friendly slack channel and chat with other cms pros to get the help you need.

GitHub Issues - think you’ve found a bug, or would like to make a feature request? Make your voice heard here. Netlify CMS is open source - PRs and other contributions are also welcome!

Stack Overflow Check StackOverflow for questions tagged “Netlify CMS” if you don’t get an answer in the Slack or the GH issues. StackOverflow reaches a worldwide audience of knowledgeable people.

Your question will be left open here for anyone to comment - but we encourage you to check out the above resources if you are still looking for a solution!

Thank you! I can’t believe I forgot about implementing the inline directive for the identity script, that resolved the issue and I’m not seeing any error messages in the console anymore.

1 Like

You are welcome @DeviousLab. I’m glad I was able to help.