prebid / prebid-server

Open-source solution for running real-time advertising auctions in the cloud.
https://prebid.org/product-suite/prebid-server/
Apache License 2.0
424 stars 721 forks source link

Missing documentation #1112

Closed alejandrofcarrera closed 4 years ago

alejandrofcarrera commented 4 years ago

Hi everyone, from some days i am trying to understand how s2s works. I am working on an advertising solution for a big enterprise (focused on video-ads, but now we are only trying to display). Our prebid.js is already configured for this kind of ads on a website, but we need to improve the scalability and of course the speed and numbers of bidders on each request.

I fully deployed prebid-server on a docker container (btw. the current Dockerfile is failing and the pull request PR1099 is not passing the tests, so you need to use this PR and comment the line 22 to go well.

The below questions are because i don´t understand the current documentation or examples, sometimes it is talking about all the endpoints and APIs over the s2s and sometimes about a thing related with saving requests on a database (doc and issue (postgre or similar) which i don´t know if i need it.

1) If i understood correctly, i need to set-up all the s2s configuration on the prebid.js like an adapter and set-up the URLs to my host instead of appnexus (https://prebid.adnxs.com) ? 2) The accountId parameter on the s2s adapter is relevant here (in theory, you need to get it from appnexus if you are using their hosts) ? 3) i need to configure the s2s server on somehow ? I know there is a configuration file which is read it by Go and it is using Viper for parsing it, but i need to provide some information about the bidders or the adapters that i need to request ?

Thanks in advance.

alejandrofcarrera commented 4 years ago

Hi everyone, from some days i am trying to understand how s2s works. I am working on an advertising solution for a big enterprise (focused on video-ads, but now we are only trying to display). Our prebid.js is already configured for this kind of ads on a website, but we need to improve the scalability and of course the speed and numbers of bidders on each request. ....

After some hours trying to understand how to configure both sides to work properly. I saw that if you put /openrtb2/auction is not the good endpoint to do the requests... the good one is /auction, but now i am getting this exception from docker container logs. Any help would be appreciated.

Edited: i tested the latest 0.89.0 version without any different result.

2019/11/15 11:28:23 http: panic serving 88.12.7.187:61232: runtime error: invalid memory address or nil pointer dereference
goroutine 151 [running]:
net/http.(*conn).serve.func1(0xc0002a8640)
        /usr/local/go/src/net/http/server.go:1769 +0x139
panic(0xba0d40, 0x1359b00)
        /usr/local/go/src/runtime/panic.go:522 +0x1b5
github.com/prebid/prebid-server/endpoints.(*auction).auction(0xc000508190, 0xdb9e20, 0xc0004f60e0, 0xc0002c4000, 0x0, 0x0, 0x0)
        /app/prebid-server/endpoints/auction.go:175 +0x8fa
github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc00045a630, 0xdb9e20, 0xc0004f60e0, 0xc0002c4000)
        /app/prebid-server/vendor/github.com/julienschmidt/httprouter/router.go:299 +0x6d1
github.com/rs/cors.(*Cors).Handler.func1(0xdb9e20, 0xc0004f60e0, 0xc0002c4000)
        /app/prebid-server/vendor/github.com/rs/cors/cors.go:200 +0x1af
net/http.HandlerFunc.ServeHTTP(0xc000623400, 0xdb9e20, 0xc0004f60e0, 0xc0002c4000)
        /usr/local/go/src/net/http/server.go:1995 +0x44
github.com/prebid/prebid-server/router.NoCache.ServeHTTP(0xdab820, 0xc000623400, 0xdb9e20, 0xc0004f60e0, 0xc0002c4000)
        /app/prebid-server/router/router.go:113 +0x231
net/http.serverHandler.ServeHTTP(0xc000228b60, 0xdb9e20, 0xc0004f60e0, 0xc0002c4000)
        /usr/local/go/src/net/http/server.go:2774 +0xa8
net/http.(*conn).serve(0xc0002a8640, 0xdbc360, 0xc00020c180)
        /usr/local/go/src/net/http/server.go:1878 +0x851
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2884 +0x2f4
W1115 11:28:23.602951       1 auction.go:217] Error from bidder ix. Ignoring all bids: context canceled
W1115 11:28:23.603170       1 auction.go:217] Error from bidder sovrn. Ignoring all bids: context canceled
W1115 11:28:23.603491       1 auction.go:217] Error from bidder appnexus. Ignoring all bids: context canceled
W1115 11:28:23.603786       1 auction.go:217] Error from bidder pubmatic. Ignoring all bids: context canceled
rpanchyk commented 4 years ago

Hi, @alejandrofcarrera! Actually /auction endpoint is pretty old one and used for legacy adapters implementation.

The most recent (and used) for now in Prebid Server is OpenRTB 2.5 protocol, so please try /openrtb2/auction - docs/endpoints/openrtb2/auction.md.

See more about OpenRTB 2.5.

hhhjort commented 4 years ago

It would be good to see what the requests you are sending look like. Also one thing to remember is that in a server to server context, you don't have access to the normal cookie syncs. For mobile apps, this usually isn't an issue, as most bidders can key off of the device ID.

For other cases, the server will need to send the user ID mappings for each bidder. PBS expects to find these mappings in user.ext.prebid.buyeruids. If the usersyncs have been done normally on the PBS host, then these mappings can be fetched by the client via the endpoint /getuids and then passed on to the server. Or the server can roll its own solution for user syncs.

alejandrofcarrera commented 4 years ago

After research deeply about how to debug the responses, i added ?pbjs_debug=true to the endpoint parameter on s2sConfig to see what was happening and changed the endpoint to the mentioned by @rpanchyk . The crash was caused by some not allowed bidders on prebid-server but yes on prebid.js so i removed them only for testing. Our main goal is to have all the current stack on our own server to expand the demand, improve the speed and call more bidders at each pageview. Later, for sure we are gonna connect it to our mobile ecosystem.

Regarding your answer @hhhjort. Can you provide more information about it ? I don't know what is the best approach to handle it, because we expect to handle all on the PBS side. Also, now I am having issues about the gdpr_consent parameter because 90% of the bidders are returning 400 on /setuid endpoint. What is the best way to do it ? I need SSL, good domain, same domain than pbjs to avoid CORS ?

Btw. Is there a way to see a debug or set a logger for each request on the server ? like logging does. It would be perfect now to have this and paste the trace here directly.

Thanks for the help.

hhhjort commented 4 years ago

I see I missread your initial statements. In a prebid server context, I think of server-to-server as a server contacting PBS rather than the client (as in the Prebid.js case). So rereading, it does look like you are using Prebid.js, so you can ignore everything I said about user syncs.

I think the next step is to determine what the issue actually is. Is the problem configuring Prebid.js to properly use Prebid Server? If so, it is probably best to post an issue in the Prebid.js project. Prebid Server accepts requests from many sources, one of them being Prebid.js. So we are not experts in using Prebid.js.

If it is a Prebid Server specific issue, then we should probably start with the request coming in to PBS, and what you expect to happen. Then we would be able to determine if there is an issue with the request sent to PBS, an issue with the configuration of the prebid server host, or even a bug with prebid server that needs to be fixed.

alejandrofcarrera commented 4 years ago

Thanks for your reply @hhhjort . I am using prebid.js (3 bidders just for testing) but now my concern is about the configuration of PBS because all the requests from the bidders are responding 400, so the cookie_sync is not working well.

The log (1 bidder) is suggesting i am using a host without SSL. So first question is how to configure PBS to get SSL working?.

The other error (2 bidders) throwed on the response of each setuid request from the bidders to PBS is about gdpr_consent specifically this message: gdpr_consent is required when gdpr=1. Regarding this i don´t know if PBJS is sending wrong parameters or if i need to configure PBS on somehow to do this properly. Can you confirm it i don´t need to configure anything ? So i can put this issue on prebid.js

This is the auction request from PBJS to PBS (removed sensitive info):

curl 'http://XXXXXX:8000/prebid/openrtb2/auction?pbjs_debug=true' -H 'Referer: http://XXXXXX:8000/www/fill_server.html' -H 'Origin: http://XXXXXX:8000' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36' -H 'Content-Type: text/plain' --data-binary '{"id":"dbaefd72-3cf0-44f9-99f7-54c3029fb064","source":{"tid":"dbaefd72-3cf0-44f9-99f7-54c3029fb064"},"tmax":5000,"imp":[{"id":"/6938/IM_EN_site/IM_EN_Leaderboard_Default","ext":{"openx":{"unit":"540655194","delDomain":"XXXXXX-com-d.openx.net"},"appnexus":{"use_pmt_rule":false,"placement_id":15333996},"pubmatic":{"publisherId":"158008","adSlot":"IM_EN_Leaderboard_1_Default@728x90"}},"banner":{"format":[{"w":728,"h":90}]}}],"test":1,"ext":{"prebid":{"targeting":{"includewinners":true,"includebidderkeys":false}}},"site":{"publisher":{"id":"1"},"page":"http://XXXXXX:8000/www/fill_server.html"},"device":{"w":2560,"h":969}}' --compressed

This is the cookie_sync request from PBJS to PBS (removed sensitive info):

curl 'http://XXXXX:8000/prebid/cookie_sync' -H 'Referer: http://XXXXXX:8000/www/fill_server.html' -H 'Origin: http://XXXXX:8000/www' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36' -H 'Content-Type: text/plain' --data-binary '{"uuid":"357a3029-d1d7-4f85-90b6-146bb6812543","bidders":["openx","appnexus","pubmatic"],"account":"1"}' --compressed
hhhjort commented 4 years ago

Could you post the exact error the bidder complaining about SSL is sending? And the endpoint URL it is currently configured to connect to. There is no way for the bidder to know if your host is set up for SSL, just if PBS is using SSL to connect to the bidder.

PBJS should be sending the correct GDPR parameters, as long as you are using a recent version and it is correctly interfacing with your CMP. That is more of a question for the PBJS group.

alejandrofcarrera commented 4 years ago

Ok. For bypass this issue we bought a domain to install SSL certificate correctly and avoid it. We don't know why but even we are using an IP on endpoint parameter of PBS adapter for PBJS the library is changing the protocol from http to https so, it is impossible to test it. The same with the cookie_sync request. So i am gonna put it on PBJS group as the same GDPR issue.

Thanks for everything, i am gonna close this issue.