Handle cases where there is no session in the request

If an error is encountered on the user's first request prior to the
session middleware being called the session might not be an attribute
of request