• Lemming
  • NEWBIE
  • 20 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
Hi,

I've been learning Lightning Components on Trailhead. I'm currently doing the project for the Lightning Superbadge and have been running into the following error when I try to reload the page for the standalone app:
 
Unable to find action 'getBoatTypes' on the controller of c:BoatSearchForm
Failing descriptor: {c:BoatSearchForm}

I've googled around and have found a lot of examples of this error where people hadn't added the @AuraEnabled annotation to their server-side controller, so the client-side controller couldn't find the method.

But, I have added that annotation and am still getting the message. It's driving me up the wall. I haven't had this issue on any other controllers I've created, and I even have another method in the same server-side controller that is being referenced by the client with no issues.

Here's my client-side controller:
({
    handleInit: function(component, event, helper) {
        // Check environment can create record
        var canCreateRecord = $A.get('e.force:createRecord');
        component.set('v.canCreateRecord', !!canCreateRecord);
        
        // Get boat types to populate boat type dropdown
        var getBoatTypesAction = component.get('c.getBoatTypes');
        getBoatTypesAction.setCallback(this, function(response) {
            var state = response.getState();
            if(state === 'SUCCESS') {
                component.set('v.boatTypes', response.getReturnValue());
            } else {
                console.log('Failed with state:', state);
            }
        });
        $A.enqueueAction(getBoatTypesAction);
    },
    
	createNewBoat : function(component, boatType) {
        var boatType = component.get('v.boatType');
        
		var createAction = component.get('c.createBoat');
        createAction.setParams({
            "type": boatType
        });
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(state === "SUCCESS") {
                console.log('SUCCESS');
            } else {
                console.log(state);
            }
        });
        $A.enqueueAction(createAction);
	}
})

and my server-side controller:
public class BoatSearchApexController {
    
    @AuraEnabled
    public static void createBoat(String type) {
        Boat__c boat = new Boat__c();
        if(type != null) {
            BoatType__c boatType = new BoatType__c(Name=type);
            insert boatType;
            boat.BoatType__c = boatType.Id;
        }
        insert boat;
    }
    
    @AuraEnabled
    public static List<BoatType__c> getBoatTypes() {
        return [Select Id, Name From BoatType__c];
    }
}

​​​​​​​
Hi,

I've been learning Lightning Components on Trailhead. I'm currently doing the project for the Lightning Superbadge and have been running into the following error when I try to reload the page for the standalone app:
 
Unable to find action 'getBoatTypes' on the controller of c:BoatSearchForm
Failing descriptor: {c:BoatSearchForm}

I've googled around and have found a lot of examples of this error where people hadn't added the @AuraEnabled annotation to their server-side controller, so the client-side controller couldn't find the method.

But, I have added that annotation and am still getting the message. It's driving me up the wall. I haven't had this issue on any other controllers I've created, and I even have another method in the same server-side controller that is being referenced by the client with no issues.

Here's my client-side controller:
({
    handleInit: function(component, event, helper) {
        // Check environment can create record
        var canCreateRecord = $A.get('e.force:createRecord');
        component.set('v.canCreateRecord', !!canCreateRecord);
        
        // Get boat types to populate boat type dropdown
        var getBoatTypesAction = component.get('c.getBoatTypes');
        getBoatTypesAction.setCallback(this, function(response) {
            var state = response.getState();
            if(state === 'SUCCESS') {
                component.set('v.boatTypes', response.getReturnValue());
            } else {
                console.log('Failed with state:', state);
            }
        });
        $A.enqueueAction(getBoatTypesAction);
    },
    
	createNewBoat : function(component, boatType) {
        var boatType = component.get('v.boatType');
        
		var createAction = component.get('c.createBoat');
        createAction.setParams({
            "type": boatType
        });
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(state === "SUCCESS") {
                console.log('SUCCESS');
            } else {
                console.log(state);
            }
        });
        $A.enqueueAction(createAction);
	}
})

and my server-side controller:
public class BoatSearchApexController {
    
    @AuraEnabled
    public static void createBoat(String type) {
        Boat__c boat = new Boat__c();
        if(type != null) {
            BoatType__c boatType = new BoatType__c(Name=type);
            insert boatType;
            boat.BoatType__c = boatType.Id;
        }
        insert boat;
    }
    
    @AuraEnabled
    public static List<BoatType__c> getBoatTypes() {
        return [Select Id, Name From BoatType__c];
    }
}

​​​​​​​
We have a VF page that basically just embeds a lightning component. We've been using this page for some time now, but then it just suddenly stopped working and showed the error: 
This page has an error. You might just need to refresh it. Assertion Failed!: Provider type not supported : false Failing descriptor: {c:LeadSearchBar}
Refreshing the page didn't help. Not sure if it's related, but I saw this on the console logs:
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://ourcompany.lightning.force.com') does not match the recipient window's origin ('https://ourcompany.cs94.my.salesforce.com').
No error on the actual debug logs.

Then when I tried to create a Lightning App Page via the Lightning App Builder and incorporate the same lightning component we used on the VF page, I got the following error:
A Component Error has occurred!

Message: 
Assertion Failed!: Provider type not supported : false

Component Descriptor: 
markup://c:LeadSearchBar

Filename:
https://ourcompany.lightning.force.com/auraFW/javascript/m1kqsGvUD3kBv3RmG5pSKA/aura_prod.js

Function:
QA.log

Line:
237

Column:
157

Stack Trace:
QA.log()@https://ourcompany.lightning.force.com/auraFW/javascript/m1kqsGvUD3kBv3RmG5pSKA/aura_prod.js:237:157
$.z.assert()@https://ourcompany.lightning.force.com/auraFW/javascript/m1kqsGvUD3kBv3RmG5pSKA/aura_prod.js:784:397
a.P.Pd()@https://ourcompany.lightning.force.com/auraFW/javascript/m1kqsGvUD3kBv3RmG5pSKA/aura_prod.js:390:477
a.P [as constructor]()@https://ourcompany.lightning.force.com/auraFW/javascript/m1kqsGvUD3kBv3RmG5pSKA/aura_prod.js:388:428
new a()@https://ourcompany.lightning.force.com/auraFW/javascript/m1kqsGvUD3kBv3RmG5pSKA/aura_prod.js:275:254
V.Db()@https://ourcompany.lightning.force.com/auraFW/javascript/m1kqsGvUD3kBv3RmG5pSKA/aura_prod.js:639:465
a.z.Pd()@https://ourcompany.lightning.force.com/auraFW/javascript/m1kqsGvUD3kBv3RmG5pSKA/aura_prod.js:333:140

Is there an Aura update on Salesforce that could have possibly caused this? 

We didn't modify anything on our code base, and the error also suddenly appeared on our sandbox, which was created days before this happened. This is why we're thinking there must be some changes on Salesforce's side we're not aware of.