Legacy Knowledge Base
Published Sep. 10, 2025

Unable to get session state in 7.4 with call that worked in 7.2

Written By

Kenny Back

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • When trying to use Liferay.Session to get the session state I get a null value (utilizing specifically javascript and call Liferay.Session.get("sessionState") and the below error. This worked in 7.2, but does not in 7.4. 
VM172:1 Uncaught TypeError: Cannot read properties of undefined (reading 'get') 
at <anonymous>:1:17

Environment

  • DXP 7.4

Resolution

  • Try instead the following method logged in or out Liferay.Session.get('sessionState')
  • You could also consider Liferay.Session.extend() before it expires and invokes a call to the backend which should keep the server side session alive
  • Lastly, you could create conditions if needed like Liferay.Session !== undefined and Liferay.Session.get('sessionState') === 'expired', but both only work for signed in users and not for guest users. So you can explore the object to see what kind of returns you need to check this against

 

 

 

 

Did this article resolve your issue ?

Legacy Knowledge Base