After weeks of research and little help from my webhost I thought I'd ask the coldfusion community.
I'm a beginner developer so bear with me. I'll provide as much info as I can think of.

I'm getting a nullpointerexception error on my site any time it sits idle for a few minutes(less than 5). If I refresh the page it works fine...until the site sits idle again. I've attached the relevant files (application.cfc and header.cfm).
It happens when GetAuthUser() is called on line 12 of header.cfm.
I've tried moving that query to onrequeststart in application.cfc and setting a session variable but then i get the same nullpointerexception there.

Another point is that I have the same exact setup on my local developer server and the error does not occur. The only difference is the lack of ssl on my developer server.

Also, if I remove the form at the bottom of the header, the error doesn't occur.

I tried to remove all the irrelevant code from the header.cfm

Thanks in advance.

<cfscript> = "TCPro_1_5";
this.applicationTimeout = createTimeSpan(0,0,90,0);
this.clientmanagement= "no";
this.loginstorage = "session" ;
this.sessionmanagement = "yes";
this.sessiontimeout = createTimeSpan(0,0,60,0);
this.setClientCookies = "yes";
this.setDomainCookies = "no";
this.scriptProtect = "all";

<cffunction name="onApplicationStart" output="false">
//set your app vars for the application
application.dsn = "tcswfldata";
application.sessions = 0;
<!--- Test whether the DB is accessible by selecting some data. --->
test query here
<!--- If we get a database error, report an error to the user, log the
error information, and do not start the application. --->
<cfcatch type="database">
catch code here
<cflog file="" type="Information" text="Application Started">
<cfreturn True>
<cffunction name="onApplicationEnd" output="false">
<cfargument name="applicationScope" required="true">
<cflog file="" type="Information" text="Application Stopped">
<cffunction name="onSessionStart" output="false">
session.started = now();
session.defaultFacility = 0;
<cflock scope="application" timeout="5" type="Exclusive">
<cfset application.sessions = application.sessions + 1>
<cflog file="" type="Information"
text="Session #session.sessionid# started.">
<cffunction name="onSessionEnd" output="false">
<cfargument name = "sessionScope" required=true/>
<cfargument name = "applicationScope" required=true/>
<cfset var sessionLength = TimeFormat(Now() - sessionScope.started, "H:mm:ss")>
<cflock name="AppLock" timeout="5" type="Exclusive">
<cfset arguments.applicationScope.sessions = arguments.applicationScope.sessions - 1>
<cflog file="" type="Information"
text="Session #arguments.sessionScope.sessionid# ended. Length: #sessionLength# Active sessions: #arguments.applicationScope.sessions#">
<cffunction name="onRequestStart" access="public" output="true">
<cfargument name="requestname" required=true/>


<!--- Check for login here --->
<cfif isDefined('form.j_username') and isDefined('form.j_password')>
cflogin here
<cfelseif isDefined('form.nd_GOEmailPword')>
reset password code here
<cfelseif isDefined('URL.emailPwd')>
an include file here
<cfelseif NOT isUserLoggedIn()>
an include file here
<cfif isUserLoggedIn()>
<cfif not structKeyExists(session,'defaultFacility')>
<cfset session.defaultFacility = 0 />
<cfif structKeyExists(form,'sessionDefaultFacility')>
<cfinvoke component="/tcswfl/TCPro/components.tcpro" method="UpdateDefaultFacility" returnvariable="qResult">
<cfinvokeargument name="defaultFacility" value="#sessionDefaultFacility#">
<cfset defaultFacility = 0 />
<cfquery name="qGetDefaultFacility" datasource="#application.dsn#">
,fu.facility_id as default_facility_id
FROM tblUsers u
join tblFacility_User fu on u.ID = fu.user_id and fu.default_facility
WHERE uName = <cfqueryparam value="#getauthuser()#" cfsqltype="cf_sql_varchar /">
<cfif qGetDefaultFacility.recordCount>
<cfset defaultFacility = qGetDefaultFacility.default_facility_id />
<cfif session.defaultFacility neq defaultFacility>
<cfset session.defaultFacility = defaultFacility />


<cffunction name="onError" output="true">
error handling here

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns=""><head>
<!--- css and javascript links go here--->
<cfif IsUserLoggedIn()>
<cfquery name="qMYID" datasource="#application.dsn#">
SELECT ID AS myID, CONCAT(firstName,' ',lastName) AS myName
FROM tblUsers
WHERE uName = <cfqueryparam value="#getauthuser()#" cfsqltype="cf_sql_varchar /">
<cfquery name="qMyLocations" datasource="#application.dsn#">
SELECT fu.facility_id
, fu.default_facility AS defFacility
, f.location
, f.description
, concat(f.location, ' ( ', f.description, ' )') as location_display_name
FROM tblFacility_User fu
join tblUsers u on fu.user_id = u.ID
join tblFacility f on fu.facility_id = f.ID
WHERE u.ID = <cfqueryparam value="#qMYID.myID#" cfsqltype="cf_sql_integer" />
<cfset utcTime = DateConvert('local2UTC',now())>
<cfinvoke component="components.timezone" method="castFromUTC" returnvariable="localTime">
<cfinvokeargument name="thisDate" value="#utcTime#">
<cfinvokeargument name="thisTZ" value="#qLocalTZ.localTZ#">
<cfif getAuthUser() NEQ ''>
<div id="contatiner">
<!---site logo goes here --->
<div id="panel">
<cfquery name="qFirstName" datasource="#application.dsn#">
SELECT firstName
FROM tblUsers
WHERE uName = '#GetAuthUser()#'
<div class="panel_content">
<table width="100%">
<td style="text-align:right">Welcome Back <cfoutput query="qFirstName"><strong>#firstName#</strong>
</cfoutput><a href="/tcswfl/TCPro/settings.cfm">(Settings)</a>
<!--- Navigation goes here --->
<div id="header_content">
<div id="panel2">
<cfif qMyLocations.recordCount gt 1>
<td style="vertical-align:top"><span class="smallText">current facility:&nbsp;</span></td>
<form action="/tcswfl/TCPro/index.cfm" method="post" name="formSelectLocation">
<select name="sessionDefaultFacility" onchange="submit();" style="font-size:10px;">
<cfoutput query="qMyLocations">
<option value="#qMyLocations.facility_id#"<cfif qMyLocations.facility_id EQ session.defaultFacility>selected=selected</cfif>>#qMyLocations.location_display_name#</option>
<cfelseif qMyLocations.recordCount eq 1>
<td><span class="smallText">Current Location: #qMyLocations.location_display_name#</span></td>