Namespace issue on registerEvent and registerEvent

Issue #1227 resolved
Rostyslav Volonchuk created an issue

I have faced a problem when defining "aura:handler" and "aura:registerEvent" withing lightning component on organization with namespace.

My source code has namespace that differs from an org, so as usual I set connection setting for Official "bookmp" and Organisation "bookdev" namespace and it works well but not for this two "aura-tags". After code deploy component stops working without any erros - just blank area.

On Developer Console and found that event type has been replaced from "c:SomeComponentEvent" into "bookdev:SomeComponentEvent" and the only thing to make it work again is to replace "bookdev" with default "c:".

Example of component:

<aura:component controller="bookmp.SomeComponentCtrl" implements="forceCommunity:availableForAllPageTypes" access="global">
    TEST COMPONENT

    <aura:handler event="bookmp:SomeComponentEvent" name="someEventName" action="{!c.handleEventMethod}" />

</aura:component>

Log file also attached.

Just found that the same thing happens if I am defining child component with namespace <bookmp:customChildComponent/>, works only with "c:".

Comments (9)

  1. Scott Wells repo owner

    Rostyslav, can you try some thing for me? Can you try saving the exact same thing from Developer Console and then refreshing the editor window to see if you see the same behavior? We saw something very similar, and it turns out that it was Salesforce changing the namespace from c to to the org namespace when saving, and it caused the same type of issue.

    Let's see if this is IC behavior or Salesforce behavior and then we can figure out where to go from there. Thanks!

  2. Rostyslav Volonchuk reporter

    After refreshing Dev Console window, the code are not changed. BUT if I save with namespace its not working too.

    Thank you!

  3. Scott Wells repo owner

    Just to clarify, are you saying that you're seeing the same behavior from Dev Console? That was our experience. I need to report that issue to Salesforce...

  4. Rostyslav Volonchuk reporter

    Yes, you are right, looks like it's SF issue. But how it is happen default "c:" replace? Official and Org namespace are known only on IDE side?

    Thank you!

  5. Scott Wells repo owner

    The org only knows about c and the org namespace. Anything you deploy from IC that includes the official namespace is translated into the org namespace, and vice-versa on retrieval. The issue here is that Salesforce is also performing its own replacement, but you're correct that it only knows about the org namespace. IC does the official<=>org translation. Hopefully that makes sense...

    I'll report this to Salesforce tomorrow so it's definitely on their radar.

  6. Scott Wells repo owner

    Hopefully you don't mind if I resolve this since it's definitely a Salesforce issue and reproducible outside of IC. I'll keep the issue pinned in my inbox so I remember to send it over to my contacts at Salesforce, though.

  7. Log in to comment