sdk icon indicating copy to clipboard operation
sdk copied to clipboard

fix(v4): lowercase proxyCountryCode in Browsers.create() and Runs.create() browserSettings

Open codeXsidd opened this issue 1 month ago • 0 comments

Problem

The v2 and v3 SDK layers consistently normalise proxyCountryCode to lowercase before sending it to the API (both Sessions.create() and Browsers.create() in v2, Sessions.create() in v3). The v4 layer skips this normalisation entirely.

Current Behavior

  • v4 Browsers.create({ proxyCountryCode: "US" }) sends "US" to the API as-is.
  • v4 Runs.create({ task: "...", browserSettings: { proxyCountryCode: "US" } }) sends "US" inside browserSettings as-is.

Both can result in a validation error from the Cloud API, which only accepts lowercase ISO 3166-1 alpha-2 codes.

Expected Behavior

Both calls should silently normalise the value to lowercase, matching the behaviour of every other SDK version.

Reproduction

Pass an uppercase country code to v4 Browsers.create() or v4 Runs.create() — the API rejects it.

Technical Context

  • src/v2/resources/browsers.ts line 34 - lowercases proxyCountryCode
  • src/v2/resources/sessions.ts line 23 - lowercases proxyCountryCode
  • src/v3/resources/sessions.ts line 42 - lowercases proxyCountryCode (added by #191)
  • src/v4/resources/browsers.ts - no normalisation
  • src/v4/resources/runs.ts - no normalisation for browserSettings.proxyCountryCode

The fix mirrors the existing pattern from #191 (v3 Sessions) applied to the two missing v4 entry points.

codeXsidd avatar Oct 23 '26 06:10 codeXsidd