I tried to refactor an existing JSForce / Visualforce application I have to work in Lightning components. Most of the refactoring was pretty straight-forward, until I get to the actual callouts. Then, I get an error: "Refused to connect to xxxx because it violates the following Content Security Policy directive: "connect-src 'self'". It looks like it can't connect to the proxy service ( I have proxyUrl: '/services/proxy' set in Connection).
Any thoughts?
Unfortunately lightning component does not allow to invoke API endpoint from component JavaScript. Additionally, there's no proxy endpoint available in the lightning domain. You need to prepare a Apex class that proxies API request as written here, but JSforce is not supporting it currently.
Well, that is a shame. Lightning seems like the perfect use case for the
JSForce libraries. Hopefully, they will come out with a proxy, or, will at
least allow callouts to their own domain (salesforce's) APIs.
Thanks for the response!
Is it still not possible to use JsForce even with Content Security Policy Trusted Sites?
Most helpful comment
Well, that is a shame. Lightning seems like the perfect use case for the
JSForce libraries. Hopefully, they will come out with a proxy, or, will at
least allow callouts to their own domain (salesforce's) APIs.
Thanks for the response!