Prebid.js icon indicating copy to clipboard operation
Prebid.js copied to clipboard

ad units mutated by bid requests

Open protonate opened this issue 9 years ago • 1 comments

Type of issue

Bug

Description

The pbjs.adUnits are passed by reference or Object.assign'd at some point resulting in mutation of the ad unit objects to include properties of bid request objects. I don't believe this would have any ill effects but is not expected and somewhat astonishing.

Steps to reproduce

  • Load a test page with a break point set on pbjs.requestBids
  • View contents of pbjs.adUnits
  • Continue code execution for pbjs.requestBids
  • View contents of pbjs.adUnits again

Expected results

The ad units array before a request for bids should match the array afterwards.

Actual results

The ad units contains properties of bid requests.

#  Before `requestBids`
{
  "code": "/12345/header-bid-tag-4",
  "sizes": [
    300,
    250
  ],
  "bids": [
    {
      "bidder": "appnexusAst",
      "params": {
        "placementId": "4799418",
        "dealId": "some deal!"
      }
    }
  ]
}

#  After `requestBids`
{
  "code": "/12345/header-bid-tag-4",
  "sizes": [
    300,
    250
  ],
  "bids": [
    {
      "bidder": "appnexusAst",
      "params": {
        "placementId": "4799418",
        "dealId": "some deal!"
      },
      "placementCode": "/19968336/header-bid-tag-4",
      "sizes": [
        300,
        250
      ],
      "bidId": "10cc3c57380433f",
      "bidderRequestId": "9c2604bca503d2",
      "requestId": "46e4084e-547f-4ea7-998a-6dbf50cf28a9"
    }
  ]
}

protonate avatar Feb 12 '17 22:02 protonate

Fixed in #1019

protonate avatar Mar 02 '17 07:03 protonate