[ColdBox 3.5.0 Final] Uncaught ReferenceError: cbox is not defined

I am brand new to CB and I’m just getting my feet wet…

In my Coldbox.cfc I defined a development environment that included the sidebar interceptor… Nice. However, I then created an interceptor “basicSecurity.cfc” and now the sidebar won’t load. I get the following Non-CF errors:

Uncaught SyntaxError: Unexpected token <

Uncaught ReferenceError: cbox is not defined

Failed to load resource: the server responded with a status of 404 (Not Found) http://local.myapp.com/coldbox/system/includes/images/bg-glass.png

Failed to load resource: the server responded with a status of 404 (Not Found) http://local.myapp.com/coldbox/system/cache/report/skins/default/images/bg-glass.png
Failed to load resource: the server responded with a status of 404 (Not Found) http://local.myapp.com/coldbox/system/includes/images/bg-glass2.png
GET http://local.myapp.com/coldbox/system/cache/report/skins/default/images/bg-glass2.png 404 (Not Found) bg-glass2.png:1

But if I remove my interceptor, it works ok.

My interceptors
interceptors = [

//Autowire
{ class=“coldbox.system.interceptors.Autowire”, properties={entityInjection=true} }
//SES
,{ class=“coldbox.system.interceptors.SES”, name=“MySES” }
//Security
,{ class=“interceptors.basicSecurity” } => Returns void
];

My Environment Definition

function development(){
// Override coldbox directives
coldbox.handlerCaching = false;
coldbox.eventCaching = false;
coldbox.debugPassword = “”;
coldbox.reinitPassword = “”;
coldbox.ColdBoxSideBar = true;
coldbox.EnableDumpVar = true;

// Add dev only interceptors
arrayAppend(interceptors,{
class=“interceptors.sidebar.ColdboxSideBar”
,properties={}
});
}

Any pointers welcome

I have tracked which is the line in my interceptor that triggers the error.

In my Colbox.cfc I created an extra Implicit Event called missingEventIDHandler=“error.noEventDefined” because the application is for management of events (galas, etc.) and before anything is even shown to the visitor I need to use the ID of the event to load into session all the necessary client data/styles/etc. In my interceptor I check for this value and it anyone is trying to get anywhere without first defining the ID, then I do:

setNextEvent(getSetting(‘missingEventIDHandler’));

If I comment this line the following error is gone and the sidebar is loaded.

Uncaught SyntaxError: Unexpected token <

Uncaught ReferenceError: cbox is not defined

Should I not add another custom implicit event? Which other way do you suggest I can do this?

These were fixed with a virtual directory

OK. I hardcoded the value of the event to redirect to, and that didn’t solve it… It is the <cfset setNextEvent(nextEvent)/> that is having issues.

Should I not use setNextEvent?? Or am I missing something?

Any help is welcomed. Thank you.

I am not sure I am tracking with you.

Can you share your interceptor and your config file.

Curt Gratz

Computer Know How

I was just about to post another reply…

This is my interceptor method… I simply changed the interception Point from preProcess to preEvent and that made everything work fine.

<cfif event.getCurrentEvent() eq getSetting(“defaultEvent”)>

<cfif event.valueExists(“eid”)>
<cfset eventid = event.getValue(“eid”)>
<cfset eventInfo = instance.eventInfoService.list(
entityName=“EventInfo”
,criteria={eventid=eventid}
,ignoreCase=true
,asQuery=true
)>
<cfset settings = instance.eventSettingService.list(
entityName=“EventSetting”
,criteria={eventid=eventid}
,ignoreCase=true
,asQuery=true
)>
<cfif ListLen(ValueList(settings.settingid))>
<cfset settings = ListToArray( ValueList(settings.settingid) )>



<cfset instance.sessionStorage.setVar(“eventInfo”, eventInfo)>
<cfset instance.sessionStorage.setVar(“eventid”, event.getValue(“eid”))>
<cfset instance.sessionStorage.setVar(“eventsettings”, settings)>
<cfset nextEvent = getProperty(“nextEventHandler”)>

<cfif instance.sessionStorage.exists(“eventid”)>
<cfset nextEvent = getProperty(“nextEventHandler”)>

<cfset nextEvent = getProperty(“noEventIDHandler”)>



<cfif not instance.sessionStorage.exists(“eventid”)>
<cfset nextEvent = getProperty(“noEventIDHandler”)>

<cfif nextEvent neq “”>

<cfset setNextEvent(nextEvent)>

Glad you got it worked out.

Is there a reason why the setNextEvent would cause an issue in the preProcess, but not on the preEvent? just for future reference.