We are finally getting to upgrade to 4.3 (all the way from 3.8). Running
Jonathan,
Do you have sessions enabled in your Application.cfc ( this.sessionManagement = true ) ?
The getVar
method in cbstorages.model.SessionStorage ensures that that key exists in the session scope, however it will throw the error you are seeing if isDefined( ‘session’ )
returns false;
Jon
Can you show the full stack trace? Also, what happens if you put some debugging (dump/aborts) in the session storage CFC to see if the session scoped data is getting created properly?
Thanks!
~Brad
ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com
it seems session is not been initiated in cbstorage module in
This error is happening while ColdBox is being loaded inside the onApplicationStart() method, which is before the user’s session even gets created! Whatever you are running in your applicationStart event might need to be moved later. You basically have a chicken and egg issue where you’re trying to use the session scope before the user’s session exists.
I’m unclear why this didn’t give you issues in ColdBox 3 unless you rearranged some stuff.
Thanks!
~Brad
ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com
We haven’t moved it around. This is how it was in 3.8.1. The code throwing the error is a preEvent interceptor. Should I just put an isDefined on session storage call?
Your best bet is to detect whether the session scope exists in your preEvent and not use the sessionStorage if it does. i honestly don’t know how this ever worked in the past for you.
Thanks!
~Brad
ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com