Can't seem to extract a session value to pass into a function or method - _.get("")

In the code below the _.get is not able to be resolved and I can not pull out the session variable (which was set earlier)


Just thought I would post my findings.
I found a hacky way to get the compiler to allow me to set a var with a session value and then use that var in another call.

Thats when I discovered something critical I was missing.

Gatling calculates all the non-session variables used in requests BEFORE it makes the requests. This means if you use a variable in your request, the request is built with whatever value the var is set to BEFORE the first request is made.

So this psedo code

var test = 1
exec(get)
.exec(post)
.exec() sessions =>{ test = session(“some extracted value” }
.exec(post test)

All requests using test will be with value = 1

Now I can solve the real problem instead of messing around with compiler issues