Error : Failed to build request: No attribute named 'access' is defined

Hi Team,
I am trying to generate bearer token dynamically and paas it to other end points but getting error

Expenses - fetchsetupdata: Failed to build request: No attribu 24 (100.0%)
te named ‘access’ is defined


private var token  = ""
  val auth = exec(getAuthToken)

  def getAuthToken() =
      http("get OAuth Req")
        .check(status is 200))
        .exec{session => { token = session("access").as[String]

  val authorization3 = Map("authorization" -> "Bearer ${access}")

  def fetchSetupData () =
      http("Expenses - fetchsetupdata")

Code from simulation file:

val expensesScenario = scenario("Expenses - Scenario")
    .during(Configuration.duration) {
        group ("load-test") {
            feed(expenseIds), feed(expenseAttendeeIds)


Tried many things but onthing or the other is going wrong. Any help will be appriciated

Hello Harshit,

When creating a post it’s really important to provide as much information as possible so you can help us help you.

What kind of authentication are you going for? One authentication by user or global token?
What did you try?

What’s your Gatling version?

Looking at the screenshot, the error you are getting is: No attribute named 'access' is defined .

This suggests that you aren’t saving the token from the header access.

Look closely at the HTTP request - especially the headers, and check that the header exists as you expect. You could use Chrome Dev Tools or any HTTP proxy for this.

All the best,

We are trying to do global authentication using bearer token.
Gatling version <gatling.version>3.6.1</gatling.version>
Actually we were able to do authentication this way in <gatling.version>3.0.0</gatling.version>
But after version upgrade we started getting this error.

Yes headers exist as expected

Thanks Harshit,

Would you mind upgrading to the latest version of Gatling? As a rule here we only provide assistance on the latest version of Gatling here and 3.6.1 is over 2 years old. Anything that old we can’t really create a reproducer on our end.

All the best,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.