function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Andres Balas 9Andres Balas 9 

I am unable to save trailhead challenge "Create a Lightning Component" -

While attempting to complete the Trailhead challenge (Snapshot # 1) I am getting an error "Failed to save undefined: Invalid definition for null:MyContactListController: null: Source" (Snapshot # 2) and cannot see why is it failing. In some article, I read that the issue could have been caused by the controller name so I change it but still no luck. Any help will be appreciated.

Snapshot # 1
User-added image
Snapshot # 2
User-added image

Lightning Component:
<aura:component controller="MyContactListController">
</aura:component>

Controller:
({
	myAction : function(component, event, helper) {
		var action = component.get("c.getContacts");
        action.setCallback(this, function(data) {
        component.set("v.contacts", data.getReturnValue());
        });
        $A.enqueueAction(action);
	}
})
Andres Balas 9Andres Balas 9
Trailhead:
https://trailhead.salesforce.com/en/projects/quickstart-lightning-components/steps/quickstart-lightning-components3
Shubham Prajapati 19Shubham Prajapati 19
The controller attribute in aura:component must contain the name of your apex class and not the name of the controller in your component bundle. Solution is to create an apex class with the name MyContactListController and then try to save your MyContactList component.
Mike  QuillMike Quill
You may have skipped the previous step to create the MyContactListController controller ( https://trailhead.salesforce.com/projects/quickstart-lightning-components/steps/quickstart-lightning-components2 )