Session not found during bulk edit operations

I’m using a custom post-function script in ScriptRunner that updates a custom field on transition.

I see in the instance logs that I have sessions timeout.

Also, I have in my script this line of code.

HttpSession session = ExecutingHttpRequest.get().getSession();

It fails with NULL because it cannot find my current session.

I came across this jira bug but I’m not sure if it is related or not and if there any other workaround possible.

https://jira.atlassian.com/browse/JRASERVER-67118