+ Start a Discussion
LinvioIncLinvioInc 

Access-Control-Allow-Origin error with ltng:require static resource in lightning flow

We're getting an "Access-Control-Allow-Origin" error when we try to include JS libraries in a lightning flow component.

We've CORS whitelisted the following:
  • https://*.force.com
  • https://*.salesforce.com
  • https://linvioevents-dev-ed.my.salesforce.com
And referenced the static resources containing the js code via $Resource in a ltng:require component:
 
<ltng:require styles=""  scripts="{!join(',','/resource/evt__JQuery/jquery-3.2.1.min.js',$Resource.EventManagement + '/moment/moment.js',$Resource.TimezonePicker+'/timezone-picker.js')}"  afterScriptsLoaded="{!c.afterJSLoaded}" />
But the platform still thinks we have a CORS problem:
 
Failed to load https://linvioevents-dev-ed.my.salesforce.com/visualforce/session?url=https%3A%2F%2Flinvioevents-dev-ed--evt.na7.visual.force.com%2Fresource%2Fevt__JQuery%2Fjquery-3.2.1.min.js: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

Has anyone else run into this?  Is there a fix/work-around?

Thanks
SandhyaSandhya (Salesforce Developers) 
Hi,

After some research I found below link ,refer if that can help you.

https://salesforce.stackexchange.com/questions/176331/no-access-control-allow-origin-locker-service-ltngrequire
 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
 
Best Regards
Sandhya