[coldbox-3.8.1] Coldbox Proxy error "Event Not Detected"

I am using ColdboxProxy.cfc so that my company’s external application can make AJAX calls to our internal coldbox app.

So far so good, in terms of, I am able to call everything in my model layer. So the external app can consume the webservice method, which calls all my model methods to save/add data to the database.

The problem arises when I want the remote function in Coldbox Proxy, to fire an event in my coldbox eventhandler.

I have scoured the google groups for any similar issues, but it seems like I am the only one with this problem. So I would like some help from the community as to what I am doing wrong.
I have also scoured the Coldbox wiki, and have followed the example[s] to the best of my knowledge.

I will try and describe what my remote function does.

I make a webservice call to coldboxproxy.cfc?method=registerUser&personID=1101&eventFlag=2&frmRegister=registrationsubmitted

So I have a remote function, obviously, called “registerUser”, I make a call out to the baseService from my model, and pass these 3 arguments to a “save()” method. My save method returns a boolean if it was successful.
So far I get result=true, check my DB, and voila, my user has been added.

It’s the last part of this method that fails. I have added CFComments below to show the part that fails.

  1. yes my proxy extends, the coldbox.system.remote.ColdboxProxy.
  2. The error that gets thrown is below:
Detail The cbevent variable does not exist in the arguments.
ErrorCode [empty string]
ExtendedInfo [empty string]
Message Event not detected

Type ColdBoxProxy.NoEventDetected

I will add the stack trace below the code snippet, in case it makes sense to anyone.
Also a quick note about my code below. basically the arguments I pass in to my remote function, I need to pass them in to the event I am trying to fire off. What’s the best way to do that? If you see the commented out line before I call super.process, that was my attempt at passing the rc variables in.

  1. Should I be setting arguments[‘event’] to some cbController method that gets an event object?
  2. My coldboxproxy.cfc, is right at the top level of my webroot, on the same level as application.cfc. I read some of the posts suggesting to set an App_Mapping, but I have no need for that since my app is the webroot. Any suggestions?

All help is greatly appreciates.
Cheers, Ali

Code Snippet taken from ColdboxProxy.cfc MethodName=RegisterLoggedIn
<cfset results = eventService.save(entityDetails = attendeeMemento,
entityTypeID = local.entityType,
matchEntityColumns = local.matchEntityColumns
) />

Stack Dump from error:
StackTrace coldfusion.runtime.CustomException: Event not detected at coldfusion.tagext.lang.ThrowTag.doStartTag(ThrowTag.java:142) at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2799) at cfUtil2ecfc561846773$funcTHROWIT.runFunction(D:\WEB\coldBox\system\core\util\Util.cfc:164) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2432) at cfColdboxProxy2ecfc415248139$funcPROCESS.runFunction(D:\WEB\coldBox\system\remote\ColdboxProxy.cfc:48) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:518) at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2624) at coldfusion.runtime.SuperScope.invoke(SuperScope.java:18) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2373) at cfRWS2ecfc1809153839$funcREGISTERLOGGEDIN22.runFunction(D:\WEB\RW2014Roadmap3\Relayware\RWS.cfc:45) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:518) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:660) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:469) at coldfusion.filter.ComponentFilter.invoke(ComponentFilter.java:193) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:442) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:79) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:112) at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:30) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:58) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.xml.rpc.CFCServlet.invoke(CFCServlet.java:155) at coldfusion.xml.rpc.CFCServlet.doGet(CFCServlet.java:289) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:414) at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:204) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722)

where is cbevent?

Aaron,
hahahaha. Darn it! You caught it, before I caught my own mistake and took this post down.
User error. aaaaaaaargh.

I forgot I changed my “event” variable to “cbEvent”, to avoid conflicts with an events module we are building :slight_smile:

However it begs the question. Now do I say arguments[‘cbEvent’]…? should that work?

Thanks,
Ali

Detail The cbevent variable does not exist in the arguments.

does arguments.cbevent exist? are you passing it in?

Aaron,

No, it doesn’t exist, and no I wasn’t passing it.

Can you please advise on how to proceed?

in my coldbox.cfc
I have the following
coldbox= {
eventName = “cbevent”,
}

Instead of
<cfset arguments[‘event’] = “eventManager.regConfirmEmail” />

so in the code snippet above, does that need to change to:
<cfset arguments[‘cbevent’] = “eventManager.regConfirmEmail” />

Now when I do that, I don’t get an error anymore, but I don’t get any errors, and the CFMail, that the event is supposed to fire off, doesn’t occur.
So I don’t really know if it’s working now or not.

Thanks,
Ali

i would start logging to see where the request goes.

Aaron,

Yeah so I turned on logging for CFMail.
In general I’m able to send garbage emails from my app.cfc and main.cfc handlers, so I know mail is going out.

However, for this specific request via the CB proxy, Mail isn’t being sent.

Unfortunately, since I’m calling my request via super.process in the coldboxproxy, I can’t do abort/dumps in my handler to check if the code is getting there.
No errors are getting thrown and logged by coldbox, which is strange. I have no idea how to proceed.

thanks again,
Ali

i would log in the receiving handler. you could also log at any intercept point.

There is not need to use the proxy for Ajax calls, really I wish people could understand that.

Ajax calls are just entry points to the API in the same manner as routes are, personally I wish the proxy shit was removed from ColdBox.

The cbevent variable does not exist in the arguments.

As that message implies, you have not passed an argument named “cbevent” into the process method. By default, the event name is called “event”, but it appears you have renamed it to “cbevent” via your coldbox.eventName setting. As such, the name of the event you pass into the process method needs to reflect that.

Change
<cfset arguments[‘event’] = “eventManager.regConfirmEmail” />

To
<cfset arguments[‘cbevent’] = “eventManager.regConfirmEmail” />

Now, that being said I would suggest you pick one approach for a given remote proxy method:

  1. Run a ColdBox event only
  2. Hit your Service layer only
    All business logic should be in the models anyway, so in theory you should be able to send an E-mail via a service call. Even better, why doesn’t the eventService.save() Automaticaly send the reg E-mail? You could even have a custom interception point for that.

And remember, the normal interception points such as preEvent and preProcess don’t fire until/if you execute an event, – so make sure you enforce any security checks necessary in your proxy prior to performing any secured tasks.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Brad/Aaron,

Thanks for pointing in me in the right direction.
I was hopped up on flu medication, all the while trying to make a deadline to get this code in. Which always leads to silly mistakes.

But yeah, the cbEvent variable is what was preventing the remote method from executing a coldbox event.

@Brad:
Few Questions:
Firstly, thanks for your advice, I have taken it and my webservice method now only hits my service layer.
So basically I just call eventService.save(myEntityObj), and then added all further logic within my eventService. Once it saves to the db, if success, I then call a method in my messageService layer to fire off a confirmation email. Everything is now working beautifully thank you.
Question:

  • If I have changed the eventName to be cbEvent, does that mean now that in all my handler methods, the “event” argument needs to be renamed to “cbEvent”
    Comments:
    The reasoning/idea behind my confirmation being a coldbox event with a view was back from my ESRI days. I built an app that sent various kinds of email, and all my email templates were in my view layer. So the handlers built up the necessary data needed for an email, and decided which email needed to be fired and called the setView for the appropriate one.
    That’s what I was trying to emulate in this instance.
    However, obviously I earned the wrath/scorn of the MVC gods, and have been, rebuked good and proper :wink:

Thanks guys, I’m glad to get this finally working, saved me another sleepless night.
cheers!
Ali