ENGINE-1965, fix call api from groovy: sessionIdNotSetException because there is no session when the engine do internal work