Vector does not support access by key

Hi guys, back again :slight_smile:

Approximately two months ago, working with the 2.0.0-SNAPSHOT version, this code worked:

I captured a list of destinations from a json response:

.exec(http(“SearchPage Destinations”)
.get( “”"${host}/destinations/?pos=${POS}&origin=${ORIG}&fields=themes,possibleTravelTime""")
.headers(headers_json)
.check(regex(“code”).exists)
.check(jsonPath("$…code").findAll.saveAs(“destinations”))

and used 20 randomly selected destinations from this list in the querystring of the next request.

.exec(http(“SearchPage Content”)

.get( “”"${host}/destinations/content/?country=${country}&language=${language}&destinations=${destinations.random},${destinations.random},${destinations.random},${destinations.random},${destinations.random},${destinations.random},${destinations.random},${destinations.random},${destinations.random},${destinations.random}""")

Somewhere in the last two months the 2.0.0-SNAPSHOT version (and in version 2.0.0-RC2 still) started to return:

Vector(AAL, YXX, ABZ, ABJ, AUH, ABV, ACA, ACC, ADD, ADL, AJA, AXT, CAK, ABY, ALB, ABQ, AES, AEX, ALG, ALA, AMM, ANC, AOI, ANE, TNR, ANR, AOJ, ATW, AUA, AKJ, AVL, ATH, ATL, AKL, AGS, AUS, BAH, BAK, BWI, BKO, BLR, BKK, BGR, BGF, BCN, BRI, BSL, BIA, BTR, EIS, BJS, BEY, BEL, BEG, BLI, BHZ, BGO, BER, BIQ, BIO, BIL, BLL, BGM, BHM, BHX, BIS, BLZ, BFN, BMI, BOG, BOI, BLQ, BON, BOD, BOS, BZN, BSB, BZV, BRE, BES, BDS, BNE, BRS, SSI, BRU, BUH, BUD, BUE, BUF, BJM, BUR, BTV, PUS, CAG, CAI, YYC, CLY, CPQ, CGR, CUN, CPT, CCS, CWL, CAS, CTA, CAY, CID, CGQ, CSX, CHS, CRW, CLT, CHO, CHA, CTU, CNX, CHI, CUU, HIB, CKG, CHC, CVG, CJS, CFE, CLE, CLJ, CGN, CMB, COS, CAE, UBS, CSG, CMH, CKY, CPH, COR, COO, CRV, CGB, CUL, CUR, CWB, CUZ, DAD, DKR, DLC, DFW, DMM, DAR, DRW, DAY, DAB, DEL, DPS, DEN, DSM, DTT, JIB, DOH, DHN, DLA, DXB, DUB, DLH, DND, DUR, MME, DUS, DZA, ELS, EDI, YEA, ELP, ELM, EBB, ERI, ESC, EUG, EVV, FAR, FYV, FAY, FSC, FNT, FLR, FLN, FLL, YMM, FMY, FSM, FWA, FDF, FOR, FRA, FNA, FAT, FUE, FUK, GBE, GNV, GVA, GOA, GRJ, GLA, GYN, GOT, GFK, GRR, GTF, GRB, GSO, GSP, GDL, CAN, GUA, GYE, KWL, KWE, GPT, KWJ, HAC, HAK, HKD, YHZ, HAM, HGH, HAJ, HAN, HRE, HRB, HAR, HFD, HAV, HLN, HEL, HMO, HIJ, SGN, HKG, HNL, HOU, HUI, HUY, HSV, IAS, IBZ, IGU, IND, INL, ISB, IST, ITH, IVL, IZO, JAC, JAN, JAX, OAJ, JKT, JED, CJU, TNA, JPA, JOE, JNB, JUB, JNU, KOJ, OGG, AZO, FCA, YKA, MKC, KHH, KHI, YLW, KTN, EYW, KRT, IEV, KGL, JRO, FIH, KIS, KKJ, KTT, TYS, KCZ, USM, KMQ, KSC, BKI, KRR, KRS, KUL, KCH, KMJ, KMG, KUO, KAO, KWI, LSE, LFT, LOS, LHE, SUF, LGK, LAN, ACE, LCA, LPA, LAS, LME, LBA, BJX, LWS, LEX, LBV, LIL, LLW, LIM, LNK, LPI, LIS, LIT, LJU, LFW, LON, LDB, LRT, LAX, SDF, LDE, LAD, FBM, LUN, LUX, LYS, MCZ, MSN, MAD, SSG, AGP, MLA, MGA, MAO, MAN, MNL, MPM, MQT, MRS, MYJ, MRU, MFR, MEL, MLB, MEM, MID, ETZ, MEX, MIA, MIL, MKE, MSP, MOT, MSQ, MSO, KMI, MOB, MLI, MBA, YQM, MLU, MLW, MTY, MVD, MGM, MPL, YMQ, YVA, MOW, MLH, BOM, MUC, MCT, MWZ, MYR, NGS, NGO, NBO, APL, NKG, NNG, NTE, NAP, BNA, NAT, NDJ, NLA, EWN, MSY, NYC, SWF, NCL, NHA, NIM, NCE, NGB, ORF, NWI, NKC, NOU, NUE, OAK, ODS, OIT, OKJ, OKA, OKC, OMA, ONT, SNA, ORL, OER, OSA, OSL, OSR, YOW, OUA, OUL, PMO, PSP, PMI, PFN, PTY, PPT, PBM, PAR, PSC, PUF, PLN, PEN, PNS, PIA, PGF, PER, PSR, PHL, PNH, PHX, HKT, PSA, PIT, KPO, PNR, PTP, PIS, PLZ, PHC, PWM, PDX, POA, BPS, PRG, PVD, PVR, PUW, PUJ, TAO, YQB, UIP, UIO, RBA, RDU, RAP, REC, REG, YQR, RNS, RNO, RCB, RIC, RIX, RIO, RUH, ROA, RST, ROC, RDZ, ROM, RVN, SAC, MBS, RUN, YYT, SKB, STT, SLC, SSA, KUF, SAT, SAN, SFO, SJC, SJO, SJD, SJU, SAL, SRZ, SCL, SDQ, SYX, SLZ, SAO, SPK, SRQ, YXE, SSM, SAV, AVP, SEA, SDJ, SEL, SEZ, SHA, SWA, SHE, SZX, SYO, SHV, SBZ, REP, SIN, FSD, AER, SOF, SBN, GEG, SGF, STL, SXM, LED, SCE, SVG, STO, SXB, STR, THS, SYD, SYR, TPE, TAK, TLH, TLL, TPA, TBS, THR, TLV, TCI, SKG, YQT, TIJ, TSR, TIA, TKS, TYO, YTO, TRC, TLN, TLS, TUF, TOY, TDX, TVC, TRI, TRS, TRD, TUS, TUL, TUN, TRN, UBJ, USN, URC, VAA, VLD, VLC, VLN, VPS, YVR, VCE, VRN, YYJ, VIE, VTE, VGO, VSA, VNO, VIX, ALW, WAW, WAS, AUW, EAT, WNZ, PBI, HPN, YXY, ICT, ILM, YWG, WUH, SIA, XMN, XNN, YKM, YNJ, YAO, SVX, EVN, YGJ, ZAG, ZNZ, CGO, ZUH, ZRH, MSE) named ‘destinations’ does not support access by key

Does anybody has suggestions on how to fix this? Much appreciated

Cheers

Daniel

Hi Daniel,

On July 1st, a few changes were made to the Expression Language (for reference, it’s this commit) and, in order to disambiguate accessing a value by its key and function calls, Gatling’s EL’s functions now requires parentheses :

.get( """${host}/destinations/content/?country=${country}&language=${language}&destinations=${destinations.random},${destinations.random},${destinations.random},${destinations.random},${destinations.random},${destinations.random},${destinations.random},${destinations.random},${destinations.random},${destinations.random}""")

By :

.get( """${host}/destinations/content/?country=${country}&language=${language}&destinations=${destinations.random()},${destinations.random()},${destinations.random()},${destinations.random()},${destinations.random()},${destinations.random()},${destinations.random()},${destinations.random()},${destinations.random()},${destinations.random()}""")

And it’ll work just fine :wink:

Cheers,

Pierre

Thanks for the fast reply, my script is working again!

I see now I could have found the solution myself here: http://gatling.io/docs/2.0.0-RC2/session/expression_el.html , my apologies!

Cheers

Daniel