I have been logging this error randomly for a little while now and tried in vain to fully resolve it.
The situation is that vars are set in a structure based on the current template. Code is simply as follows
application.config = {};
application.config.script_bootstrap_popper = '<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>';
savecontent variable="application.appTmpl.body_close_pre" {
if ( structKeyExists(application.config, 'script_bootstrap_popper') && !isNull(application.config.script_bootstrap_popper) ) {
writeOutput(application.config['script_bootstrap_popper']);
}
}
The exception that is “only sometimes (not 100% of the time)” thrown is
the value from key [script_bootstrap_popper] is NULL, which is the same as not existing in CFML
When I log the exception including a dump of the application scope sure enough the key is present and populated so I am a little in the dark on why the exception i sthrown. This only happens when the template is called via an ajax (fetch) call fyi
Any guidance on what I am overlooking would be greatly appreciated.
Don’t forget to tell us about your stack!
OS: Win Server 2019
Java Version: 11.0.4 (AdoptOpenJDK) 64bit
Tomcat Version: 9.0.24
Lucee Version: 5.3.4.77