diff --git a/modules/prebidServerBidAdapter/bidderConfig.js b/modules/prebidServerBidAdapter/bidderConfig.js index 3b51810ff20..f6f4fb91389 100644 --- a/modules/prebidServerBidAdapter/bidderConfig.js +++ b/modules/prebidServerBidAdapter/bidderConfig.js @@ -52,7 +52,7 @@ export function extractEids({global, bidder}) { function getEntry(eid) { let entry = entries.find((candidate) => deepEqual(candidate.eid, eid)); if (entry == null) { - entry = {eid, bidders: []} + entry = {eid, bidders: new Set()} entries.push(entry); } if (bySource[eid.source] == null) { @@ -74,12 +74,12 @@ export function extractEids({global, bidder}) { (deepAccess(bidderConfig, path) || []).forEach(eid => { const entry = getEntry(eid); if (entry.bidders !== false) { - entry.bidders.push(bidderCode); + entry.bidders.add(bidderCode); } }) }) }) - return {eids: entries, conflicts}; + return {eids: entries.map(({eid, bidders}) => ({eid, bidders: bidders && Array.from(bidders)})), conflicts}; } /** diff --git a/test/spec/modules/prebidServerBidAdapter_spec.js b/test/spec/modules/prebidServerBidAdapter_spec.js index 85ae7909f34..fc0f9ed7b68 100644 --- a/test/spec/modules/prebidServerBidAdapter_spec.js +++ b/test/spec/modules/prebidServerBidAdapter_spec.js @@ -2130,7 +2130,7 @@ describe('S2S Adapter', function () { bidders: [], source: 'idD' }]); - }) + }); it('should repeat global EIDs when bidder-specific EIDs conflict', () => { BID_REQUESTS.push({ @@ -4638,6 +4638,21 @@ describe('S2S Adapter', function () { ], conflicts: ['idA', 'idB'] } + }, + { + t: 'duplicated bidder-specific eids', + bidder: { + bidderA: { + user: { + eids: [mkEid('id'), mkEid('id')] + } + } + }, + expected: { + eids: [ + eidEntry('id', 'id', ['bidderA']) + ] + } } ].forEach(({t, global = {}, bidder = {}, expected}) => { it(t, () => {