diff --git a/modules/prebidServerBidAdapter.js b/modules/prebidServerBidAdapter.js
index 6533d9d00ee6..c217b2934edb 100644
--- a/modules/prebidServerBidAdapter.js
+++ b/modules/prebidServerBidAdapter.js
@@ -589,7 +589,7 @@ const OPEN_RTB_PROTOCOL = {
response.seatbid.forEach(seatbid => {
(seatbid.bid || []).forEach(bid => {
const bidRequest = utils.getBidRequest(
- this.bidMap[`${bid.impid}${seatbid.seat}`],
+ this.bidMap[`${bid.impid}${seatbid.seat}`].bid_id,
bidderRequests
);
@@ -704,11 +704,12 @@ export function PrebidServer() {
/* Notify Prebid of bid responses so bids can get in the auction */
function handleResponse(response, requestedBidders, bidderRequests, addBidResponse, done) {
let result;
+ let bids = [];
try {
result = JSON.parse(response);
- const bids = protocolAdapter().interpretResponse(
+ bids = protocolAdapter().interpretResponse(
result,
bidderRequests,
requestedBidders
@@ -734,7 +735,13 @@ export function PrebidServer() {
utils.logError('error parsing response: ', result.status);
}
- done();
+ const videoBid = bids.some(bidResponse => bidResponse.bid.mediaType === 'video');
+ const cacheEnabled = config.getConfig('cache.url');
+
+ // video bids with cache enabled need to be cached first before they are considered done
+ if (!(videoBid && cacheEnabled)) {
+ done();
+ }
doClientSideSyncs(requestedBidders);
}
diff --git a/src/adaptermanager.js b/src/adaptermanager.js
index 3d5d56d6ee22..4c60b01d8fa8 100644
--- a/src/adaptermanager.js
+++ b/src/adaptermanager.js
@@ -393,12 +393,20 @@ exports.registerBidAdapter = function (bidAdaptor, bidderCode, {supportedMediaTy
};
exports.aliasBidAdapter = function (bidderCode, alias) {
- var existingAlias = _bidderRegistry[alias];
+ let existingAlias = _bidderRegistry[alias];
if (typeof existingAlias === 'undefined') {
- var bidAdaptor = _bidderRegistry[bidderCode];
+ let bidAdaptor = _bidderRegistry[bidderCode];
if (typeof bidAdaptor === 'undefined') {
- utils.logError('bidderCode "' + bidderCode + '" is not an existing bidder.', 'adaptermanager.aliasBidAdapter');
+ // check if alias is part of s2sConfig and allow them to register if so (as base bidder may be s2s-only)
+ const s2sConfig = config.getConfig('s2sConfig');
+ const s2sBidders = s2sConfig && s2sConfig.bidders;
+
+ if (!(s2sBidders && includes(s2sBidders, alias))) {
+ utils.logError('bidderCode "' + bidderCode + '" is not an existing bidder.', 'adaptermanager.aliasBidAdapter');
+ } else {
+ exports.aliasRegistry[alias] = bidderCode;
+ }
} else {
try {
let newAdapter;
diff --git a/src/constants.json b/src/constants.json
index c8a7c3ebefc3..3bbad70585ab 100644
--- a/src/constants.json
+++ b/src/constants.json
@@ -66,6 +66,7 @@
],
"S2S" : {
"SRC" : "s2s",
+ "DEFAULT_ENDPOINT" : "https://prebid.adnxs.com/pbs/v1/openrtb2/auction",
"SYNCED_BIDDERS_KEY": "pbjsSyncs"
}
}
diff --git a/src/prebid.js b/src/prebid.js
index 56c9d1d0c7ce..767180f32867 100644
--- a/src/prebid.js
+++ b/src/prebid.js
@@ -340,9 +340,15 @@ $$PREBID_GLOBAL$$.requestBids = createHook('asyncSeries', function ({ bidsBackHa
const adUnitMediaTypes = Object.keys(adUnit.mediaTypes || {'banner': 'banner'});
// get the bidder's mediaTypes
- const bidders = adUnit.bids.map(bid => bid.bidder);
+ const allBidders = adUnit.bids.map(bid => bid.bidder);
const bidderRegistry = adaptermanager.bidderRegistry;
+ const s2sConfig = config.getConfig('s2sConfig');
+ const s2sBidders = s2sConfig && s2sConfig.bidders;
+ const bidders = (s2sBidders) ? allBidders.filter(bidder => {
+ return !includes(s2sBidders, bidder);
+ }) : allBidders;
+
if (!adUnit.transactionId) {
adUnit.transactionId = utils.generateUUID();
}
diff --git a/test/spec/modules/prebidServerBidAdapter_spec.js b/test/spec/modules/prebidServerBidAdapter_spec.js
index 8bc3d577ede4..cd2022bcab7d 100644
--- a/test/spec/modules/prebidServerBidAdapter_spec.js
+++ b/test/spec/modules/prebidServerBidAdapter_spec.js
@@ -246,7 +246,7 @@ const RESPONSE_OPENRTB = {
'bid': [
{
'id': '8750901685062148',
- 'impid': '123',
+ 'impid': 'div-gpt-ad-1460505748561-0',
'price': 0.5,
'adm': '',
'adid': '29681110',
@@ -285,7 +285,7 @@ const RESPONSE_OPENRTB_VIDEO = {
bid: [
{
id: '1987250005171537465',
- impid: '/19968336/header-bid-tag-0',
+ impid: 'div-gpt-ad-1460505748561-0',
price: 10,
adm: 'adnxs',
adid: '81877115',
diff --git a/test/spec/unit/core/adapterManager_spec.js b/test/spec/unit/core/adapterManager_spec.js
index df03af5f3547..0e33fc005d5e 100644
--- a/test/spec/unit/core/adapterManager_spec.js
+++ b/test/spec/unit/core/adapterManager_spec.js
@@ -19,7 +19,8 @@ const CONFIG = {
timeout: 1000,
maxBids: 1,
adapter: 'prebidServer',
- bidders: ['appnexus']
+ bidders: ['appnexus'],
+ accountId: 'abc'
};
var prebidServerAdapterMock = {
bidder: 'prebidServer',
@@ -719,6 +720,36 @@ describe('adapterManager tests', () => {
expect(AdapterManager.videoAdapters).to.include(alias);
});
});
+
+ describe('special case for s2s-only bidders', () => {
+ beforeEach(() => {
+ sinon.stub(utils, 'logError');
+ });
+
+ afterEach(() => {
+ config.resetConfig();
+ utils.logError.restore();
+ });
+
+ it('should allow an alias if alias is part of s2sConfig.bidders', () => {
+ let testS2sConfig = utils.deepClone(CONFIG);
+ testS2sConfig.bidders = ['s2sAlias'];
+ config.setConfig({s2sConfig: testS2sConfig});
+
+ AdapterManager.aliasBidAdapter('s2sBidder', 's2sAlias');
+ expect(AdapterManager.aliasRegistry).to.have.property('s2sAlias');
+ });
+
+ it('should throw an error if alias + bidder are unknown and not part of s2sConfig.bidders', () => {
+ let testS2sConfig = utils.deepClone(CONFIG);
+ testS2sConfig.bidders = ['s2sAlias'];
+ config.setConfig({s2sConfig: testS2sConfig});
+
+ AdapterManager.aliasBidAdapter('s2sBidder1', 's2sAlias1');
+ sinon.assert.calledOnce(utils.logError);
+ expect(AdapterManager.aliasRegistry).to.not.have.property('s2sAlias1');
+ });
+ });
});
describe('makeBidRequests', () => {