Old Session atributes in jmix

I would like to introduce atributes in any moment in the user session, and use this ones for the new roleRow(constrints), I have try with SessionData and its look ist not working (cant’t find) , this maybe because i try in the roles with :current_user_mySessionDataVariable, but the old sintax is not working
either (:session$mySessionDataVariable), there is a new sintax for those attributes?, I know is not working more in the groups, but should work on execution rigth?.
I want tha something like this work :

where = "{E}.id = :session$entityId"

How do you create a session attribute in your code current_user_mySessionDataVariable before using it in constraints?

Thats the thing I am asking for, I tried:

sessionData.setAttribute("mySessionDataVariable", 1);

You can use the following predefined query parameter prefixes to access current session and user attributes:

  • session_<attributeName> gives access to a session attribute (stored using SessionData)
  • current_user_<attributeName> gives access to a current user attribute

These parameters work in any JPQL query, including Filter conditions and row-level JPQL policies, for example:

select e.id from sales_Customer e where e.name = :session_customerName

Implemented in

This was usefull, It should be in the docs, becasuse I only saw a small reference to current_user_, and not the session part. Said that I still have problems with it, I am getting:
image
Debuggin I saw the problem is that in some point this varible gets null in the function processParameters of QueryImpl, I dont know why is doing this only some times, I try to use the currentAuthentication and it is correct, but…
image
I have to say that iI am using and old service from cuba to do this, but I also try to doit on the screenFrangment, and the result is the same. There is something I am forgetting?

this is the full error I am getting:

com.vaadin.server.ServerRpcManager$RpcInvocationException: Unable to invoke method click in com.vaadin.shared.ui.button.ButtonServerRpc
	at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:157) ~[vaadin-server-8.14.1-1-jmix.jar:8.14.1-1-jmix]
	at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:115) ~[vaadin-server-8.14.1-1-jmix.jar:8.14.1-1-jmix]
	at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:442) ~[vaadin-server-8.14.1-1-jmix.jar:8.14.1-1-jmix]
	at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:407) ~[vaadin-server-8.14.1-1-jmix.jar:8.14.1-1-jmix]
	at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:275) ~[vaadin-server-8.14.1-1-jmix.jar:8.14.1-1-jmix]
	at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:83) ~[vaadin-server-8.14.1-1-jmix.jar:8.14.1-1-jmix]
	at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) ~[vaadin-server-8.14.1-1-jmix.jar:8.14.1-1-jmix]
	at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1636) ~[vaadin-server-8.14.1-1-jmix.jar:8.14.1-1-jmix]
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:465) ~[vaadin-server-8.14.1-1-jmix.jar:8.14.1-1-jmix]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:750) ~[javax.servlet-api-4.0.1.jar:4.0.1]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.60.jar:9.0.60]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:102) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:93) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:147) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.18.jar:5.3.18]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.18.jar:5.3.18]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar:5.6.2]
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354) ~[spring-web-5.3.18.jar:5.3.18]
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267) ~[spring-web-5.3.18.jar:5.3.18]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.18.jar:5.3.18]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.18.jar:5.3.18]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.18.jar:5.3.18]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.18.jar:5.3.18]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.18.jar:5.3.18]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.18.jar:5.3.18]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:889) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1743) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
	at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]
Caused by: java.lang.reflect.InvocationTargetException: null
	at jdk.internal.reflect.GeneratedMethodAccessor232.invoke(Unknown Source) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
	at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:153) ~[vaadin-server-8.14.1-1-jmix.jar:8.14.1-1-jmix]
Caused by: java.lang.reflect.InvocationTargetException: null

	... 83 common frames omitted
Caused by: java.lang.IllegalStateException: Query argument current_user_username not found in the list of parameters provided during query execution.
	at org.eclipse.persistence.internal.jpa.QueryImpl.processParameters(QueryImpl.java:592) ~[org.eclipse.persistence.jpa-2.7.9-6-jmix.jar:na]
	at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:183) ~[org.eclipse.persistence.jpa-2.7.9-6-jmix.jar:na]
	at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:482) ~[org.eclipse.persistence.jpa-2.7.9-6-jmix.jar:na]
	at io.jmix.eclipselink.impl.JmixEclipseLinkQuery.getResultFromCache(JmixEclipseLinkQuery.java:827) ~[jmix-eclipselink-1.2.2.jar:na]
Caused by: java.lang.IllegalStateException: Query argument current_user_username not found in the list of parameters provided during query execution.

	at io.jmix.eclipselink.impl.JmixEclipseLinkQuery.getResultList(JmixEclipseLinkQuery.java:138) ~[jmix-eclipselink-1.2.2.jar:na]
	at io.jmix.eclipselink.impl.JpaDataStore.executeQuery(JpaDataStore.java:502) ~[jmix-eclipselink-1.2.2.jar:na]
	at io.jmix.eclipselink.impl.JpaDataStore.loadAll(JpaDataStore.java:166) ~[jmix-eclipselink-1.2.2.jar:na]
	at io.jmix.core.datastore.AbstractDataStore.loadList(AbstractDataStore.java:127) ~[jmix-core-1.2.2.jar:na]
	at io.jmix.core.impl.UnconstrainedDataManagerImpl.loadList(UnconstrainedDataManagerImpl.java:112) ~[jmix-core-1.2.2.jar:na]
	at io.jmix.core.FluentLoader$ByQuery.list(FluentLoader.java:486) ~[jmix-core-1.2.2.jar:na]
	at es.properly.extranet.service.ProyectoServiceBean.getNumProyects(ProyectoServiceBean.java:290) ~[main/:na]
	at es.properly.extranet.web.screens.proyecto.ProyectoFragment.onAfterInit(ProyectoFragment.java:52) ~[main/:na]
	at io.jmix.core.common.event.EventHub.publish(EventHub.java:170) ~[jmix-core-1.2.2.jar:na]
	at io.jmix.ui.screen.ScreenFragment.fireEvent(ScreenFragment.java:87) ~[jmix-ui-1.2.2.jar:na]
	at io.jmix.ui.screen.UiControllerUtils.fireEvent(UiControllerUtils.java:60) ~[jmix-ui-1.2.2.jar:na]
	at io.jmix.ui.sys.FragmentHelper$FragmentLoaderInitTask.execute(FragmentHelper.java:149) ~[jmix-ui-1.2.2.jar:na]
	at io.jmix.ui.xml.layout.loader.ComponentLoaderContext.executeInitTasks(ComponentLoaderContext.java:167) ~[jmix-ui-1.2.2.jar:na]
	at io.jmix.ui.sys.FragmentsImpl.init(FragmentsImpl.java:210) ~[jmix-ui-1.2.2.jar:na]
	at io.jmix.ui.component.impl.FragmentImpl.attached(FragmentImpl.java:332) ~[jmix-ui-1.2.2.jar:na]
	at io.jmix.ui.component.impl.AbstractComponent.setParent(AbstractComponent.java:206) ~[jmix-ui-1.2.2.jar:na]
	at io.jmix.ui.component.impl.AbstractOrderedLayout.add(AbstractOrderedLayout.java:78) ~[jmix-ui-1.2.2.jar:na]
	at io.jmix.ui.component.impl.AbstractOrderedLayout.add(AbstractOrderedLayout.java:42) ~[jmix-ui-1.2.2.jar:na]
	at es.properly.extranet.screen.main.MainScreen.createFragments(MainScreen.java:250) ~[main/:na]
	at es.properly.extranet.screen.main.MainScreen.lambda$cambiarUsuario$2(MainScreen.java:275) ~[main/:na]
	at io.jmix.ui.builder.AfterCloseListenerAdapter.accept(AfterCloseListenerAdapter.java:34) ~[jmix-ui-1.2.2.jar:na]
	at io.jmix.ui.builder.AfterCloseListenerAdapter.accept(AfterCloseListenerAdapter.java:24) ~[jmix-ui-1.2.2.jar:na]
	at io.jmix.core.common.event.EventHub.publish(EventHub.java:170) ~[jmix-core-1.2.2.jar:na]
	at io.jmix.ui.screen.Screen.fireEvent(Screen.java:124) ~[jmix-ui-1.2.2.jar:na]
	at io.jmix.ui.screen.Screen.close(Screen.java:330) ~[jmix-ui-1.2.2.jar:na]
	at io.jmix.ui.screen.Screen.close(Screen.java:351) ~[jmix-ui-1.2.2.jar:na]
	at es.properly.extranet.web.screens.cliente.Selectorcliente.selectClient(Selectorcliente.java:30) ~[main/:na]
	at es.properly.extranet.web.screens.cliente.Selectorcliente.onSelectClientClick(Selectorcliente.java:21) ~[main/:na]
	at io.jmix.core.common.event.EventHub.publish(EventHub.java:170) ~[jmix-core-1.2.2.jar:na]
	at io.jmix.ui.component.impl.AbstractComponent.publish(AbstractComponent.java:85) ~[jmix-ui-1.2.2.jar:na]
	at io.jmix.ui.component.impl.ButtonImpl.buttonClicked(ButtonImpl.java:78) ~[jmix-ui-1.2.2.jar:na]
	at io.jmix.ui.widget.JmixButton.fireClick(JmixButton.java:77) ~[jmix-ui-1.2.2.jar:na]
	at com.vaadin.ui.Button$1.click(Button.java:57) ~[vaadin-server-8.14.1-1-jmix.jar:8.14.1-1-jmix]
	... 87 common frames omitted

The probleme comes when I try to make a query with datamanager, I already check I have permissons to read everything in the query. I might be releted with fragments?,has the fragment created in execution time the same session?.

EDIT:

I might be releted with fragments?

I don’t think this is the case because I tried with usuarl screens and it happening the same.

The following code in a screen controller works for me:

@Autowired
private DataManager dataManager;
@Autowired
private Notifications notifications;

@Subscribe("sampleBtn")
public void onSampleBtnClick(Button.ClickEvent event) {
    List<Customer> myEntityList = dataManager.load(Customer.class)
            .query("select c from Customer c " +
                    "where c.manager.username = :current_user_username")
            .list();

    notifications.create().withCaption("Size: " + myEntityList.size()).show();
}

Could you provide a test project where your problem is reproduced?

And it’s now in the docs: JPQL Extensions :: Jmix Documentation

I got a similar error with a row-level policy created like this with :current_user_username condition, when the browser screen for the entity under this policy contained DataGrid with aggregated column. It was tough to find the reason, and now I cannot reproduce the issue to report it.

The proyect is complex and create a simple one is not that easy, but I found that the problems come in the JpqlRowLevelPolicy where query. For what I saw only works if there is only a session variable, but it goes wrong if there are two like my case. Example:

@JpqlRowLevelPolicy(
            entityClass = Proyect.class,
            where = "{E}.client.id = :session_idClient " +
                    "or {E}.client.user.username = :current_user_username " +
                    "or (select u from RegiUsers u where u.user.username = :current_user_username) " +
                    "member of {E}.client.company.users"
    )
    void proyect();

This is an example not what I have, but I found out that if I take out session_idClient or current_user_username, It is not showing error.

Thanks for the investigation!
It was a stupid bug indeed:

The fix will be available in the next patch, probably next week.

You’re welcome, I hope this will come soon, we really need it.