artilleryio / artillery

The complete load testing platform. Everything you need for production-grade load tests. Serverless & distributed. Load test with Playwright. Load test HTTP APIs, GraphQL, WebSocket, and more. Use any Node.js module.
https://www.artillery.io
Mozilla Public License 2.0
8.06k stars 511 forks source link

Cookie Failed to Parse #3308

Closed sam-barker closed 2 months ago

sam-barker commented 3 months ago

Setting a cookie in my flows seems to keep causing an error, and I'm not sure why. If I remove any mention of cookies the error goes away. But I am confused as to why the cookie cannot be parsed, even with the unsafe-disabled security prefix set

Version info:

2.0.19

Running this command:

npx artillery run --quiet src/config/step-load-test.yml    

I expected to see this happen:

No errors when setting a cookie

Instead, this happened:

Error: Cookie failed to parse

Files being used:

config:
  target: "https://dunelm.com"
  http:
    cookieJarOptions:
      prefixSecurity: "unsafe-disabled"
  phases:
    - duration: 1m
      rampTo: 3
      maxVusers: 3
      name: steady_state
  plugins:
    expect: 
      useOnlyRequestNames: true
      reportFailuresAsErrors: true
      expectDefault200: true
    metrics-by-endpoint:
      useOnlyRequestNames: true
      metricsNamespace: "scenario"
    ensure:
      maxErrorRate: 1
  payload:
    - path: "../data/search.csv"
      skipHeader: true
      cast: false
      loadAll: false
      fields:
        - "searchTerm"
scenarios:
  - name: "Search"
    flow:
      - get:
          url: "/search"
          cookie:
            LoadTest: "true"
          qs:
            q: "{{ searchTerm }}"
sam-barker commented 3 months ago

@hassy Here's my second issue :D

hassy commented 3 months ago

have you tried setting looseMode: true under cookieJarOptions as well? (https://github.com/salesforce/tough-cookie/blob/master/lib/cookie/cookieJar.ts#L171) We rely on ToughCookie, so I'm wondering if the cookie is not strictly compliant with RFC 6265

sam-barker commented 3 months ago

@hassy Just tried it and I get the same error. I've tried looseMode and loose and it doesn't seem to make any difference