I am currently using LCC npm module (Lightning Container) to make Apex calls in our React app.

However, we are also exploring cutting out LCC altogether (the concern is that it has not been updated in 4 years), as our app is currently in a lighting web component iframe wrapped in an aura parent div. Since aura components can speak directly to apex, I am using a callback to get the actual data I need from Apex. However, the data does not update on the static resource. Is there a way to do this?


<aura:component controller="ContactController" implements="force:hasRecordId,flexipage:availableForAllPageTypes" access="global" >
    <aura:attribute name="recordId" type="String" />
    <aura:handler name="init" value="{!this }" action="{!c.doInit }"/>
    <lightning:container src="{!$Resource.demo_salesforce_hello + '/index.html?recordid=' + v.recordId}" onerror="{!c.handleError}"/>


doInit : function(component, event, helper) {
    //var recordId = component.get('v.recordId');
    var action = component.get("c.serverEcho");
    action.setParams({recordId : component.get('v.recordId') });
    action.setCallback(this, function(response) {
        var state = response.getState();
        if (state === "SUCCESS") {
            console.log("From server: " + JSON.stringify(response.getReturnValue()));
            component.set("v.recordId", JSON.stringify(response.getReturnValue()));               
        else if (state === "INCOMPLETE") {
            // do something
        else if (state === "ERROR") {
            var errors = response.getError();
            if (errors) {
                if (errors[0] && errors[0].message) {
                    console.log("Error message: " + 
            } else {
                console.log("Unknown error");


public static Contact[] serverEcho(String recordId) {
    String contactId = [SELECT ContactId FROM Case WHERE Id= :recordId].ContactId;
    System.debug([SELECT Id, Name, LOB__c, PlanName__c FROM Contact WHERE Id= :contactId]);
    return [SELECT Id, Name, LOB__c, PlanName__c FROM Contact WHERE Id= :contactId];

1 Answer 1


You use the message function:

<lightning:container aura:id="container" src="{!$Resource.demo_salesforce_hello + '/index.html?recordid=' + v.recordId}" onerror="{!c.handleError}"/>



This is outlined in the documentation.

  • Thank you! I am now calling: LCC.addMessageHandler(function (message) { console.log("MESSAGE", message);}); But I get VFRemote.js:117 Visualforce Remoting: Context incomplete - authorization not provided
    – Nour
    Commented Nov 16, 2021 at 4:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .