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
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
msftbid adapter supports two ways of identifying inventory:placement_id, or the pairmember+inv_code. The second one cannot work in its current implementation.Steps to reproduce
Configure an ad unit with the member / inv_code pair:
Run an auction and inspect the outgoing request to
ib.adnxs.com.Expected
https://ib.adnxs.com/openrtb2/prebidjs?member_id=12345&eqt=1Actual
https://ib.adnxs.com/openrtb2/prebidjs?member_id=[object%20Object]&eqt=1The request still succeeds, so nothing is logged — you just never get a bid.
Root cause
modules/msftBidAdapter.js, informatRequest():Array.prototype.findreturns 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.
isBidRequestValidrequires member to be a number:(typeof params.member === 'number' && isNotEmptyString(params?.inv_code))But
modules/msftBidAdapter.mddocuments it as a String and usesmember: "123"in every example.Platform details
Reproduced on Prebid.js 10.14.0. The same code is still present on
mastertoday, so the issue should still apply on 11.29.0