I am trying to create a component dynamically in lightning. In the following code, I get an error saying, "Error: TypeError: Cannot read property 'getDescriptor' of undefined"

The first argument in $A.createComponent should be of type string. When I explicitly put the value 'c:confirmComponent' as the first param in createComponent method, the component displays fine. However, when i refer it by a variable as (namespace + ":" + componentName), I get a TypeError.

Previously, It was working fine and I do not if this is because of any summer19 changes or not.

    onInit : function(component, event, helper) {
        var namespace = component.get("v.namespace"),
            componentName = component.get("v.componentname"),
            id = component.get("v.recordId");
            namespace + ":" + componentName,
                recordId: id,
                param1: component.get('v.param1'),
                param2: component.get('v.param2')
            function(newCmp, status, errorMessage){
                if (status === "SUCCESS") {
                    var body = component.get("v.body");
                    component.set("v.body", body);
                else if (status === "INCOMPLETE") {
                else if (status === "ERROR") {
                    console.log("Error: " + errorMessage);



Any idea on how I can solve this issue?

  • Suggest you add console.log(namespace + ":" + componentName) immediately before the $A.createComponent call to see if that value is indeed 'c:confirmComponent'. And if it isn;t work back from there. – Keith C Jun 21 at 8:26

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.