event.getCurrentModule() is empty when using 'alias'


I have a custom module in a CB5 app in the folder modules_app\foo
We want this custom module to be approachable also via another route, nameley `bar', to be used by a specific group of users, which distinguishes in functionality
In Coldbox 4 we had the line

in Routes.cfm. This worked as expected:

Navigating to https://myapp/foo resulted in my event.getCurrentModule() to be foo.
Navigating to https://myapp/bar resulted in my event.getCurrentModule() to be foo.

In CB5 addModuleRoutes(pattern="/bar",module="foo") results in an error Error importing routes configuration file:

So I have tried to switch to aliases,

Now when I go to https://myapp/foo, my event.getCurrentModule() is foo.
however when I go to https://myapp/bar, my event.getCurrentModule() is empty, where I expect it to be foo.


Luis Majano
August 3, 2020, 7:30 PM

The issue is that the way modules are loaded has now changed since cb5 and 6. Therefore, the delayed approach to issuing more entry points is to use the new DSL method `route().toModuleRouting()`. This will delay execution for you and wait for modules to be loaded and then register the entry point

JWJ van der Drift
February 20, 2020, 1:31 PM

Turns out, adding the following to the onLoad function in Moduleconfig.cfc, makes it work

Is this still a bug, or does it just need documentation?



Won't Fix


Luis Majano


JWJ van der Drift