[Coldbox 5.6.2] The invalidEventHandler setting is also invalid

I’ve set up a custom invalidEventHandler value in my Coldbox config.cfc file, but for some reason any time I execute an invalid handler, I get the following exception error message:

“The invalidEventHandler setting is also invalid: error.onInvalidEvent. Please check your settings”

I do have a handler called “Error.cfc” and it does have a method in it called onInvalidEvent which calls a basic 404.cfm view file. I can’t figure out why Coldbox doesn’t display my configured handler.

Note: I already ran box update in Commandbox to make sure all of my dependencies are up to date. I also attempted running both Lucee and ACF 2016 and I still get the same problem.

If anyone has any tips for troubleshooting the root cause, please do share! I very much appreciate the insight!

I’ve just run into the same issue. Coldbox v.5.6.2+1021. Having invalidEventHandler=“Main.onInvalidEvent” configured in Coldbox.cfc results in the “The invalidEventHandler setting is also invalid: error.onInvalidEvent. Please check your settings” error.

I’ve performed a simple experiment. Added the following command in line 408 of the https://github.com/ColdBox/coldbox-platform/blob/development/system/web/services/HandlerService.cfc:

writeDump("invalidEvent called, request._lastInvalidEvent value: " & request._lastInvalidEvent);

invalidEvent() method seems to be called twice:

Commenting out this line: coldbox-platform/HandlerService.cfc at development · ColdBox/coldbox-platform · GitHub makes the configured invalidEventHandler execute as expected.

Well, this is just masking the symptoms. Changing the framework is not the solution. I don’t know what system this runs on, but one thing I noticed is that in the configuration “error.onInvalidEvent” is without capital E, but the handler “Error.cfc” is with capital E. Maybe that is something to align?

I am still working on solving the issue. I ran a few more tests on a blank “coldbox create app” and the invalidEventHandler Coldbox setting works as expected. I am not convinced that it is a bug in the framework yet and I will report back here after I learn anything new from my troubleshooting efforts.

Have you by any chance been using the “cbsecurity” module? It was the culprit in my case. It’s been reported here:

@Jacek, very interesting!

I am not using cbsecurity, but I am using “cbguard”. Here are my dependencies from the box.json file for reference:

"dependencies":{ "coldbox":"^5.0.0", "cbswagger":"^2.0.0", "cbmessagebox":"^3.1.0+46", "cbvalidation":"^1.5.1+78", "mementifier":"^1.9.0+59", "cbguard":"^4.0.0", "cbauth":"^4.0.0", "BCrypt":"^2.5.0-snapshot" },

FWIW, I believe cbguard has been rolled into cbsecurity 2. I would guess that they will respond more quickly to issues raised there.

cbguard and cbsecurity remain separate projects. cbsecurity 2.0 added a lot of features inspired by cbguard.

I wanted to provide a quick update. I spent some time trying to figure out
the best way to fix this issue so I could submit a pull request.
Unfortunately, I am stuck and think it may take help from someone more
familiar with how cbguard works. In the meantime, I have submitted an
issue on Github for cbguard here:

Good news, 404 pages everywhere can rejoice! This issue has been fixed in
cbguard 4.1.1. Thanks to Eric for rolling this fix out so quickly!

Ref: Release v4.1.1 · coldbox-modules/cbguard · GitHub

Thanks for such a detailed error report. That made it quick to find.

I just did a box update and now have

* cbauth (4.1.2) -> forgebox version: (4.1.2)
  cbsecurity (2.3.0+86) -> forgebox version: (2.3.0+86)

And this issue still remains for me

*Type:* HandlerService.InvalidEventHandlerException
*Message:* The invalidEventHandler event is also invalid
*Detail:* The invalidEventHandler setting is also invalid:
Main.pageNotFound. Please check your settings
*Timestamp:* 04/02/2020 04:00:56 PM

You’d need to open up an issue on cbsecurity for that. The issue fixed before was for cbguard .

@Scott Conklin,
I just submitted a pull request for cbSecurity with the same fix Eric used for cbGuard. Once implemented, it should make using the invalidEventHandler setting safe for apps that use cbSecurity as well.

Sorry for the delay on this, I had meant to submit an issue or PR earlier.