5

I get this error just randomly:

Uncaught Error in $A.getCallback() [Cannot read property 'config' of undefined]
Callback failed: apex://taskKanbanController/ACTION$getKanbanWrap

Here's the relevant controller code:

({
    doInit: function(component, event, helper) {

        console.log('doInit doInit doInit doInit!!!!!!!!! ' + component.getGlobalId());    
        var vfOrigin = "https://" + component.get("v.vfHost");

        window.addEventListener("message", function(event) {
               console.log("EVENT HERE!");
            console.dir(event);


            try{
                event.data.indexOf('s');
            }catch(err){
                return;
            }
            if(event.data.indexOf('isUnload') > -1  || event.data.indexOf('isLoaded') > -1){
                helper.hideSpinner(component);
                return;
            }
            if (event.origin !== vfOrigin || event.data.indexOf('FileUpload') > -1)
                return;

            if(event.data == 'Need Projects'){
                helper.ganttPstMsg(component, 'kanbanData',null);                
            }else if(event.data.indexOf('onTaskClick') == 0){
                var msg = (event.data).split('-');
                component.set("v.recordName",msg[2]);
                component.set("v.recordId",msg[1]);
                component.set("v.rViewFlag",true);
            }else if(event.data == 'Task order changed update data on root component'){
                helper.doInitHelp(component,helper, false);
            }else if(event.data.indexOf('newTaskAdd') == 0){
                var msg = (event.data).split('-');
                component.set('v.recordId',msg[1]);
                $('.newTaskBBB').click();
            }

        }, false);


          helper.doInitHelp(component,helper, false);
        document.addEventListener("DOMContentLoaded", function(event) { 
              setTimeout(helper.alignProjs(),1000);
            });



    },

And here's the relevant helper code, where execution fails:

doInitHelp : function(component, helper, viewChange) {
        console.log('doInitHelp');
        var prjLst = [];
        var resLst = [];




        console.log('firstLoad>>>>>>>>>>  '+ component.get('v.firstLoad'));
        if(!component.get('v.firstLoad')){
            var checkboxes = component.find('prjCheckbox');
            if(checkboxes)
            if(Array.isArray(checkboxes)){
                for (var i = 0; i < checkboxes.length; i++){
                    if(checkboxes[i].get("v.checked"))
                        prjLst.push(checkboxes[i].get("v.name"));
                }
            }else{
                if(checkboxes.get("v.checked"))
                    prjLst.push(checkboxes.get("v.name"));
            }
            var rcheckboxes = component.find('userCheckbox');
            if(rcheckboxes)
            if(Array.isArray(rcheckboxes)){
                for (var i = 0; i < rcheckboxes.length; i++){
                    if(rcheckboxes[i].get("v.checked"))
                        resLst.push(rcheckboxes[i].get("v.name"));
                }
            }else{
                if(rcheckboxes.get("v.checked"))
                    resLst.push(rcheckboxes.get("v.name"));
            }
            if(component.get('v.menuItem') == 'Searched'){
                prjLst = [];
                prjLst.push(component.get("v.searchPrj").Project__c);
            }
            console.log('SearchedSearchedSearchedSearched::   ' + component.get("v.searchPrj").Project__c);
        }

        console.dir(prjLst);
        var action = component.get("c.getKanbanWrap");
        action.setStorable();
        action.setParams({
            "menuItem":component.get('v.menuItem'),
            "prjs":prjLst.toString(),
            "ress":resLst.toString(),
            "firstLoad":component.get('v.firstLoad')
        });

        action.setCallback(this, function(response){
            helper.handleResponse(component, helper, viewChange, response, null);
        });
        $A.enqueueAction(action);

    },
    handleResponse : function(component, helper, viewChange, response, recId) {
        console.log('HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH');
        var state = response.getState();
            if (state === "SUCCESS") {

                console.dir(response.getReturnValue());
                //console.log(JSON.stringify(response.getReturnValue()));

                var kd = response.getReturnValue();
                if(kd.userTmSetting.Current_Tab__c == 'kanban'){
                    var list = kd.lst;
                    for (var i = list.length - 1; i >= 0; i--) {
                        list[i]['sIdx']=list[i].lstSize > 0 ? 0 : list[i].lstSize - 1;
                        list[i]['eIdx']=list[i].lstSize > 25 ? 25 : list[i].lstSize;
                    }    
                }


                console.dir("DEBUG1")
                console.dir(component.get("v.kanbanData"))
                >>component.set("v.kanbanData", kd);<<
                console.dir("DEBUG2");
                component.set("v.viewComponent", kd.userTmSetting.Current_Tab__c);
                console.dir("DEBUG3");
                component.set('v.menuItem',kd.userTmSetting.Current_Menu_Item__c);
               console.dir("DEBUG4");

Execution fails exactly at the marked (">> <<") portion and I have no clue why. kd is not null

5
  • "I was playing arround with my javascript Controller code and randomly this happened" --> things don't happen randomly when you start messing around in code, and the error message is providing a pretty good clue of what and where to check. do you have access to the controller code? it would be a good place to check as well or could give you a better idea of what is missing that throws this error
    – glls
    Jun 11, 2018 at 23:24
  • My bad, I posted this elsewhere, but I re-referenced old code and there's no difference. The error message points to the internal aura framework logic which is obfuscated and almost impossible to debug. Yes, I have access to controller logic, but I don't see why it would be a controller error as the error popup itself shows a javascript runtime error. Jun 11, 2018 at 23:35
  • well, once you figure out where "Cannot read property 'config' of undefined" is coming from, feel free to update your post
    – glls
    Jun 12, 2018 at 1:07
  • @glls That's the problem, I can't. The error message comes from an internal function and I don't have the resources to debug it. Jun 12, 2018 at 2:35
  • 1
    This sounds silly, but I had a lightning:spinner without an alternativeText param on my Component. I got a warning in the console asking to add the alternativeText. I fixed the issue, and the [Cannot read property 'config' of undefined] went away Jul 26, 2018 at 14:37

4 Answers 4

0

My case was quite similar: I had lightning:input with aura:id attribute and onclick action which triggered action and got same issue.

After removing aura:id attribute problem solved

0

In case anyone else gets this error, I found it was because I had to use force:outputField instead of lightning:outputField when editing a component that mixed aura and lightning...

0

In my case I got this error because was using the "fieldName" attribute after calling the force:recordData callback.

In the component:

<force:recordData aura:id="service"
              layoutType="FULL"
              recordId="{!v.boatReview.Id}"
              fields="Id, Name, Comment__c, Boat__c"
              targetFields="{!v.boatReview}"
              targetError="{!v.recordError}"
              mode="EDIT"
              recordUpdated="{!c.onRecordUpdated}"
              />

<lightning:input aura:id="nameId" variant="label-hidden" fieldName="{!v.boatReview.Name}" />

and in controller being called on init():

component.find("service").getNewRecord(
            "BoatReview__c", // sObject type (objectApiName)
            null,      // recordTypeId
            false,     // skip cache?
            $A.getCallback(function() {
                var rec = component.get("v.boatReview");
                var error = component.get("v.recordError");
                if(error || (rec === null)) {
                    console.log("Error initializing record template: " + error);
                    return;
                } else {
                     component.set("v.boatReview.Boat__c", component.get("v.boat.Id"));
                }
                console.log("Record template initialized: " + rec.apiName);
            })
        );

Removing the "fieldName="{!v.boatReview.Name}" " in the component did the trick

0

For me it worked after I replaced

<lightning:input type="checkbox" checked="{!OpportunityTeamMember.Local_contact_person__c}" disabled="true" data-user="{!OpportunityTeamMember.UserId}" onclick="{!c.changeLocalContactPerson}"/>

with

<input type="checkbox" name="options" id="checkbox-unique-id-85" checked="{!OpportunityTeamMember.Local_contact_person__c}" data-user="{!OpportunityTeamMember.UserId}" onclick="{!c.changeLocalContactPerson}"/>

I did not naarowed it down to which attribut was causing the problem. Maybe 'disabled' or 'data-user'

You must log in to answer this question.

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