6

I am receiving this error:

Uncaught Assertion Failed!: Descriptor for Config required for registration : undefined Callback failed: apex://AccConListController/ACTION$getAccounts

This error occures when i call the function doInit in the javascript controller

Javascript Controller

({
doInit : function(component, event, helper) {    
    console.log('v.recordID: '+component.get("v.recordId"));
    console.log('v.currentSObjectName: '+component.get("v.sObjectName"));

    helper.getDuns(component);
    component.set("v.showContacts", component.find("checkboxContacts").get("v.value"));
    component.set("v.showLeads", component.find("checkboxLeads").get("v.value"));


},  })

Helper

({
getDuns:  function(component) {  
    var action = component.get("c.getDunsByRecordId");
    action.setParams({
        "currentRecordID": component.get("v.recordId"),
        "currentSObjectName" : component.get("v.sObjectName") 
    });
    //Set up the callback
    var self = this;
    action.setCallback(this, function(actionResult) {
        component.set("v.currentRecordDuns", actionResult.getReturnValue());  
        this.getAccounts(component);
        this.getLeads(component);

        console.log('v.currentRecordDuns: '+component.get("v.currentRecordDuns"));
        console.log('v.AccountNameForLead: ' +component.get("v.AccountNameForLead"));
        console.log('leads: ' + component.get("v.Leads"));
        console.log('account: ' + component.get("v.Accounts"));        
    });        
    $A.enqueueAction(action); 
},
getAccounts: function(component) {  
    if(component.get("v.sObjectName") == 'Lead')
    {
        var action = component.get("c.getCompanyNameByDuns");
        action.setParams({
            "dunsNumber": component.get("v.currentRecordDuns"),
        });
        //Set up the callback
        var self = this;
        action.setCallback(this, function(actionResult) {
            component.set("v.AccountNameForLead", actionResult.getReturnValue());
            component.set("v.AccountIDForLead", '1');
        });        
        $A.enqueueAction(action);   

    }


    else
    {
        var action = component.get("c.getAccounts");
        action.setParams({
            "currentDuns": component.get("v.currentRecordDuns"),
            "freeTextFilter": component.find("freeTextFilter").get("v.value")   
        });
        //Set up the callback
        var self = this;
        action.setCallback(this, function(actionResult) {
            component.set("v.Accounts", actionResult.getReturnValue());            
        });        
        $A.enqueueAction(action); 

    }


}, 
getLeads: function(component) {    
    var action = component.get("c.getLeads");
    action.setParams({
        "currentDuns": component.get("v.currentRecordDuns"),
        "freeTextFilter": component.find("freeTextFilter").get("v.value")   
    });
    //Set up the callback
    var self = this;
    action.setCallback(this, function(actionResult) {
        component.set("v.Leads", actionResult.getReturnValue());            
    });        
    $A.enqueueAction(action); 

 }, })

Apex Class

public class AccConListController {
    @AuraEnabled
    public static List<Account> getAccounts(String currentDuns,String freeTextFilter) {
        String q = 'SELECT Id, Name,DunsNumber, BillingCountry, Type, (select name, Phone, Email FROM Contacts where Name like \'%' + freeTextFilter +  '%\' or Phone like \'%' + freeTextFilter +  '%\' or Email like  \'%' + freeTextFilter +  '%\') FROM Account  where DunsNumber=:currentDuns';
        List<Account> accounts= Database.query(q);
        System.debug(q);
        return accounts;
    }
}

3 Answers 3

13

i found the error, it was very dumb... in a different component that i use there was an aura:if block that was empty and did nothing, and made everything fail. after i removed it, it worked fine

3

You'll also see this error if you have an empty else tag.

<aura:set attribute="else"></aura:set>

Do this instead

<aura:set attribute="else"><span></span></aura:set>
2

The names of your apex method and the helper controller js in your lightning components should not be same .This triggers a recursion .

Please update the name of your helper to something else

getAccountsFromServer: function(component) {  
 /// Rest of the code
}
3
  • i did what you said and it didnt help. but ill know from now that they shouldnt be the same. Thank you
    – Dana Griff
    Mar 30, 2017 at 16:36
  • Recursion only happens if apex controller's method and component's controller.js method have the same name.
    – Praveen
    Mar 30, 2017 at 19:22
  • This answer is misleading here. It has nothing to do with this recursion. The exact reason to get the stated error are: emtpy aura:if blocks or ever empty aura:set else block will cause them. Also the error is very cryptic and misleading by itself. The accepted answere is correct
    – Uwe Heim
    Sep 26, 2017 at 13:19

You must log in to answer this question.

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