Skip to content

Commit

Permalink
fix for userSync endpoint getting called with bidder alias names, ins…
Browse files Browse the repository at this point in the history
…tead of actual bidder names (prebid#4265)
  • Loading branch information
Fawke authored and sa1omon committed Nov 28, 2019
1 parent 6ab0ade commit 8d9bcfd
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 46 deletions.
9 changes: 6 additions & 3 deletions modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Adapter from '../../src/adapter';
import { createBid } from '../../src/bidfactory';
import * as utils from '../../src/utils';
import { ajax } from '../../src/ajax';
import { STATUS, S2S, EVENTS } from '../../src/constants';
import adapterManager from '../../src/adapterManager';
import { config } from '../../src/config';
Expand All @@ -11,6 +10,7 @@ import { isValid } from '../../src/adapters/bidderFactory';
import events from '../../src/events';
import includes from 'core-js/library/fn/array/includes';
import { S2S_VENDORS } from './config.js';
import { ajax } from '../../src/ajax';

const getConfig = config.getConfig;

Expand Down Expand Up @@ -148,7 +148,6 @@ function queueSync(bidderCodes, gdprConsent) {
}
}
const jsonPayload = JSON.stringify(payload);

ajax(_s2sConfig.syncEndpoint,
(response) => {
try {
Expand Down Expand Up @@ -960,7 +959,11 @@ export function PrebidServer() {

if (_s2sConfig && _s2sConfig.syncEndpoint) {
let consent = (Array.isArray(bidRequests) && bidRequests.length > 0) ? bidRequests[0].gdprConsent : undefined;
queueSync(_s2sConfig.bidders, consent);
let syncBidders = _s2sConfig.bidders
.map(bidder => adapterManager.aliasRegistry[bidder] || bidder)
.filter((bidder, index, array) => (array.indexOf(bidder) === index));

queueSync(syncBidders, consent);
}

const request = protocolAdapter().buildRequest(s2sBidRequest, bidRequests, validAdUnits);
Expand Down
Loading

0 comments on commit 8d9bcfd

Please sign in to comment.