function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Raghu Natha 2Raghu Natha 2 

Unable to get data from Apex class in lightning Out component


Created a Lightning Web Component which gets the contacts on click of a button from an Apex class. The functionality works as expected when the component is used inside salesforce.

When the same component is used outside salesforce, the component is unable to fetch data.
Code: Lightninhout html code (
Below is my lightning out component deployed to Heroku

When I click on the button "Load Contacts" I see the below error.
Access to XMLHttpRequest at '' from origin '' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.