Skip to main content

Does anyone have a good solution to overcoming the CSP error “connect-src ‘self’” when trying to call a REST API within the org? (e.g. We have a page that uses method 2 from Zach’s https://community.skuid.com/t/calling-apex-function). Of course the call works as expected if we use the VF page but we are looking toward optimization.


Thanks in advance

Hi Arne-Per, we checked in with our developers. Calling the standard REST API is explicitly prevented in Lightning. You either have to write your own Apex and make the methods AuraEnabled, or do some trickery like what is described in that blog entry: https://douglascayers.com/2018/09/10/calling-rest-api-from-lightning-components-without-named-credentials/  You can also find more information here: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_api_calls_platform.htm


Yeah that is what I was finding in the docs. Was curious if your team had trickery of their own. thank you for the links. Am familiar with Doug’s solution. Will look into AuraEnabled. The challenge is that it is an installed package. Thanks again!


Reply