What does this coldbox error mean? ```2022-07-28 1...
# box-products
d
What does this coldbox error mean?
Copy code
2022-07-28 15:12:27 coldbox.system.web.services.HandlerService The invalidEventHandler event (Error.onInvalidEvent) is also invalid: | ExtraInfo: {"ROUTE":"","CALLSTACK":[{"Template":"E:\\sites\\api\\coldbox\\system\\web\\services\\HandlerService.cfc","LineNumber":"470","Function":"INVALIDEVENT"},{"Template":"E:\\sites\\api\\coldbox\\system\\web\\services\\HandlerService.cfc","LineNumber":"333","Function":"GETHANDLERBEAN"},{"Template":"E:\\sites\\api\\coldbox\\system\\web\\Controller.cfc","LineNumber":"753","Function":"_RUNEVENT"},{"Template":"E:\\sites\\api\\coldbox\\system\\web\\Controller.cfc","LineNumber":"658","Function":"RUNEVENT"},{"Template":"E:\\sites\\api\\coldbox\\system\\Bootstrap.cfc","LineNumber":"290","Function":"PROCESSCOLDBOXREQUEST"},{"Template":"E:\\sites\\api\\coldbox\\system\\Bootstrap.cfc","LineNumber":"507","Function":"ONREQUESTSTART"},{"Template":"E:\\sites\\api\\Application.cfc","LineNumber":"42","Function":"ONREQUESTSTART"}],"FULLEVENT":".","REQUESTEVENT":"","ROUTEDURL":"","REGISTEREDHANDLERS":"customRestHandler,Error,Main","EVENT":""}
Got this from the coldfusion-error.txt log file
This is occurring in my app about 4 or 5 times an hour. Users are not reporting issues so I'm not sure how to reproduce it, and the log time doesn't match up with errors caught in Fusion Reactor.
b
It means the invalidEventHandler event (Error.onInvalidEvent) is also invalid 🙂
To reproduce it, hit an event that doesn't exist on your site
Copy code
<http://site.com/foo/bar|site.com/foo/bar>
actually, looking at at the error, it seems the event was
.
s
i assume bots are hitting it
b
Try
Copy code
<http://site.com/index.cfm?event=|site.com/index.cfm?event=>.
Or, just test your invalid event handler directly and see if it works!
Copy code
<http://site.com/index.cfm?event=Error.onInvalidEvent|site.com/index.cfm?event=Error.onInvalidEvent>
d
Dude I'm so tired today(or all the time). I am asking some dumb questions.
.com/index.cfm?event=Error.onInvalidEvent
result:
Copy code
coldfusion.runtime.UndefinedElementException: Element INVALIDEVENT is undefined in PRC.
    at coldfusion.runtime.CfJspPage.resolveCanonicalName(CfJspPage.java:2862)
    at coldfusion.runtime.CfJspPage._resolve(CfJspPage.java:2778)
    at coldfusion.runtime.CfJspPage._resolveAndAutoscalarize(CfJspPage.java:3074)
    at coldfusion.runtime.CfJspPage._resolveAndAutoscalarize(CfJspPage.java:3064)
    at coldfusion.runtime.CfJspPage._resolveAndAutoscalarize(CfJspPage.java:3025)
    at cfError2ecfc1777516260$funcONINVALIDEVENT.runFunction(E:\sites\apistaging1\handlers\Error.cfc:19)
I have this in my Error handler:
Copy code
function onInvalidEvent(event,rc,prc){

		prc.results = {};
		prc.results["status"] = "FAIL";
		prc.results["detail"] = prc.invalidEvent;
		prc.results["message"] = "Invalid Event";
		prc.results["data"] = rc;

		event.renderData( data=prc.results, type='json', statusCode=404 );

}
I'm pretty sure I got this from coldbox docs. prc.invalidEvent should be there.
b
Yeah, that error is good
it means the event is real
Of course, if you call it directly, it won't have the prc.invalidevent being passed to it
So the question is why coldbox thinks it's invalid
You'd probably need to put in some logging to see exactly what sort of request is triggering your invalid event handler
And perhaps there's an error happening from inside your invalid event handler which is making ColdBox think it's invalid
d
I can't think of where I need to put a log. If I put a log in the onInvalidEvent method prc.invalidEvent is going to error out anyways.
.com/index.cfm?event=some.invalidevent
something like this actual outputs the json I expect with the prc.invalidEvent value of 'some.invalidevent'.
even this
.com/some/invalidevent
outputs 'some.invalidEvent' for prc.invalidEvent.
I only suggested that since your error above had this in it
Copy code
FULLEVENT":"."
but I don't now if that means an actual period was sent in or if that was just the output of
#handler#.#action#
where everything was an empty string
It could also be happening from an unexpected place like onSessionEnd which isn't going to have any CGI vars