0

Synopsis: we have a Salesforce lightning app that works fine in the dev org, but once we create a managed package and install it in orther orgs, if fails with this CORS error:

Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘https://ashoktest-dev-ed.lightning.force.xn--com-to0a) does not match the recipient window’s origin (‘https://ashoktest-dev-ed--blusign.ap15.visual.force.xn--com-to0a).

Here are the steps to reproduce the issue in a simple lightning app

1) Create a Custom Button on Opportunity with following formula. "/apex/namespace__testHelloVFpage" Name This button testHello. Drag and drop this button in Opportunity pagelayout to use it.

2) Create a Visual force page using below code and Name it as testHelloVFpage

<apex:page sidebar="true" showHeader="true" standardController="Opportunity">
    <apex:includeLightning />
    <center><div id="lightning" style="margin-left:1%;max-width:75%;margin-bottom:2%;"/></center>
<script >
    $Lightning.use("namespace:testHelloEsignPageApp", function() {
        $Lightning.createComponent("namespace:testHelloEsignLC",
        {},
        "lightning",
        function(component) {window.$Force = sforce;});
    });

</script>
</apex:page>

3) Create a Lightning app using below code and name it as testHelloEsignPageApp

<aura:application access="GLOBAL" extends="ltng:outApp">
    <aura:dependency resource="namespace:testHelloEsignLC"/>
</aura:application>

4) Create Lightning component bundle using below component code and name it testHelloEsignLC

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" 
                access="global" >
########### This is a Test Component ###############
    <br></br>
    ***********   Hello ESign *************
</aura:component>

5) Now once we click on custom button that we have created in step one, it will show us this Lightning page. No issues

NOTE :- nameSpace in above code is domain name.

BUT,

Once we have created a Managed Beta or Managed package and install it in any Developer edition or any other domain orgs, We are getting BLANK page. And the errors in INSPECT Element Console as follows. I am not getting any logs also.

Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘https://ashoktest-dev-ed.lightning.force.xn--com-to0a) does not match the recipient window’s origin (‘https://ashoktest-dev-ed--blusign.ap15.visual.force.xn--com-to0a).

And

typeError - error is undefined

And

Uncaught TypeError: Cannot read property 'split' of undefined at displayErrorText (lightning.out.delegate.js?v=1558631590920:70) at lightning.out.delegate.js?v=1558631590920:178 at XMLHttpRequest.xhr.onreadystatechange (lightning.out.delegate.js?v=1558631590920:112)

Tried the following:

  1. checked if we are missing any namespaces and it is not an issue.
  2. Tried Hard coding origin URL in navigateToURL section to open the page from component - failed.
  3. Tried skipping the any sort of events which are firing in component for navigation and used window.open, did nothing.
  4. Tried opening this page in URL by adding IDs manually to bypass calling component(Sign with BluSign component in UI) and got the same error.
  5. Tried enabling Development Mode for user
  • Have you ever solved it? – zaitsman Jul 23 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.