Before I dive into my problem, I do want to mention that I did do my due diligence and spent the last two days researching this problem, to no avail, so here it goes:

So I'm getting the following error when trying to load an action method from the controller: Unable to resolve the request "ecaApi/main/doGeocodeRequest". I get this error if I try and navigate directly to it, e.g. domain.com/actions/ecaApi/main/doGeocodeRequest

The AJAX request below also generates a 404.

File Structure:

- craft/plugins
  - ecaapi
    - controllers


 namespace Craft;

    class EcaApi_MainController extends BaseController
        protected $allowAnonymous = true;

        public function actionDoGeocodeRequest() {

JS ajax call to the action method

    var data = {
        address: "{{ event.event_location }}"
    data[csrfTokenName] = csrfTokenValue;
    data['action'] = 'ecaApi/main/doGeocodeRequest';
        method: "POST",
        url: "/",
        data: data
        .done(function (data) {
            markers[{{ event.id }}] = new google.maps.Marker({
                position: new google.maps.LatLng(data.results[0].geometry.location.lat, data.results[0].geometry.location.lng),
                map: map,
                {% if mapSettings.mapIcon %}
                icon: mapMarkerIcon,
                {% endif %}
                title: "{{ event.title }}"
            var content = '<a href="{{ event.url|replace({'http://': 'https://'}) }}">{{ event.title }}</a>';
            var window = new google.maps.InfoWindow({
                content: content
            markers[{{ event.id }}].addListener('click', function () {
                window.open(map, markers[{{ event.id }}]);


Any help would be appreciated, I've been pulling out my hair for days over this.

  • "Unable to resolve the request "ecaApi/main/test". Was that the actual error or was it "Unable to resolve the request "ecaApi/main/doGeocodeRequest"? Not seeing a controller action named test in your example.
    – Brad Bell
    Jul 20, 2017 at 3:22
  • @BradBell I clarified that part, pasted the wrong error!
    – stojda
    Jul 20, 2017 at 3:27
  • Your EcaApiPlugin.php file has a class name of EcaApiPlugin?
    – Brad Bell
    Jul 20, 2017 at 3:29
  • @BradBell Yes indeed!
    – stojda
    Jul 20, 2017 at 3:32
  • 1
    Hrm... my gut says it's some silly case sensitivity issue, but I'm not seeing it from the example. Couldn't hurt to generate the boilerplate plugin code from pluginfactory.io to help rule that out.
    – Brad Bell
    Jul 20, 2017 at 3:35

1 Answer 1


Ok so thanks to @BradBell's suggestion, I regenerated the skeleton of my plugin and it's controller using pluginfactory.io and it now magically works! Still not sure exactly what the difference was, but it does its job now!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.