Skip to content

msftBidAdapter member bid param is serialized as "[object Object]" in the endpoint query string #15485

Description

@GautierDeMo

Hello, I hope you're doing great.
It's my first time submitting an issue and it's related to a use case at work, so I hope the description is okay.

The msft bid adapter supports two ways of identifying inventory: placement_id, or the pair member + inv_code. The second one cannot work in its current implementation.

Steps to reproduce

Configure an ad unit with the member / inv_code pair:

{
  bidder: 'msft',
  params: { member: 12345, inv_code: 'my_inventory_code' }
}

Run an auction and inspect the outgoing request to ib.adnxs.com.

Expected

https://ib.adnxs.com/openrtb2/prebidjs?member_id=12345&eqt=1

Actual

https://ib.adnxs.com/openrtb2/prebidjs?member_id=[object%20Object]&eqt=1

The request still succeeds, so nothing is logged — you just never get a bid.

Root cause

modules/msftBidAdapter.js, in formatRequest():

const memberId = ((bidderRequest?.bids) || []).find(bid => bid.params && bid.params.member && isNumber(bid.params.member));
if (memberId) {
  endpointUrl += (endpointUrl.indexOf('?') === -1 ? '?' : '&') + 'member_id=' + memberId;
}

Array.prototype.find returns the matching element, not the value inspected by the predicate.

Suggested fix

const memberId = ((bidderRequest?.bids) || []) .find((bid) => isNumber(bid.params?.member))?.params.member;

Additional issue: documentation inconsistency

While looking into this, a second inconsistency surfaced on the same parameter. isBidRequestValid requires member to be a number:

(typeof params.member === 'number' && isNotEmptyString(params?.inv_code))

But modules/msftBidAdapter.md documents it as a String and uses member: "123" in every example.

Platform details

Reproduced on Prebid.js 10.14.0. The same code is still present on master today, so the issue should still apply on 11.29.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
Needs OP

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions