New Adapter: Synapse HX#4795
Conversation
Code coverage summaryNote:
synapseHXRefer here for heat map coverage report |
| @@ -0,0 +1,21 @@ | |||
| endpoint: "https://rtb.hx.compasonline.com/pbs" | |||
There was a problem hiding this comment.
Verified the endpoint is live
curl -i --location --request POST "https://rtb.hx.compasonline.com/pbs"
HTTP/1.1 400 Bad Request
Content-Length: 0
Date: Tue, 02 Jun 2026 20:30:19 GMT
Server: Kestrel
| @@ -0,0 +1,21 @@ | |||
| endpoint: "https://rtb.hx.compasonline.com/pbs" | |||
| maintainer: | |||
| email: prebid@compas-inc.com | |||
There was a problem hiding this comment.
We've sent an email to this address. Please respond to the email to verify that it is reachable.
| redirect: | ||
| url: "https://sync.hx.compasonline.com/pbserver/image?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&ccpa={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&redirect={{.RedirectURL}}" | ||
| userMacro: "${VISITOR_ID}" |
There was a problem hiding this comment.
Is this endpoint live? I sent the following request which hangs:
https://sync.hx.compasonline.com/pbserver/image?gdpr=0&gdpr_consent=&ccpa=&gpp=&gpp_sid=&redirect=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3DsynapseHX%26gdpr%3D0%26gdpr_consent%3D%26gpp%3D%26gpp_sid%3D%26f%3Di%26uid%3D%24%7BVISITOR_ID%7D
There was a problem hiding this comment.
Thank you. Endpoint has been fixed.
| url: "https://sync.hx.compasonline.com/pbserver/image?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&ccpa={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&redirect={{.RedirectURL}}" | ||
| userMacro: "${VISITOR_ID}" | ||
| iframe: | ||
| url: "https://sync.hx.compasonline.com/pbserver/iframe?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&ccpa={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&redirect={{.RedirectURL}}" |
There was a problem hiding this comment.
Is this endpoint live? I sent the following request which hangs:
https://sync.hx.compasonline.com/pbserver/iframe?gdpr=0&gdpr_consent=&ccpa=&gpp=&gpp_sid=&redirect=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3DsynapseHX%26gdpr%3D0%26gdpr_consent%3D%26gpp%3D%26gpp_sid%3D%26f%3Db%26uid%3D%24%7BVISITOR_ID%7D
There was a problem hiding this comment.
Thank you. Endpoint has been fixed.
| case openrtb2.MarkupVideo: | ||
| return openrtb_ext.BidTypeVideo, nil | ||
| default: | ||
| return "", fmt.Errorf("unsupported media type %d", bid.MType) | ||
| } |
There was a problem hiding this comment.
Please add supplemental JSON tests to cover these cases.
| if err := jsonutil.Unmarshal(request.Imp[0].Ext, &bidderExt); err != nil { | ||
| errors = append(errors, fmt.Errorf("failed to unmarshal bidder ext: %w", err)) | ||
| } | ||
|
|
||
| var ext openrtb_ext.ExtImpSynapseHX | ||
| if err := json.Unmarshal(bidderExt.Bidder, &ext); err != nil { | ||
| errors = append(errors, fmt.Errorf("failed to unmarshal bidder parameters: %w", err)) | ||
| } |
There was a problem hiding this comment.
If you're unable to successfully unmarshal the bidder params, you won't have the tenant ID. In that case, I think you want to early return with nil, errors instead of hitting the bidder endpoint with no tenant ID. Thoughts?
|
|
||
| requestBody, err := jsonutil.Marshal(request) | ||
| if err != nil { | ||
| errors = append(errors, fmt.Errorf("failed to marshal request: %w", err)) |
There was a problem hiding this comment.
Same thing here, early return nil, errors?
| } | ||
|
|
||
| var errs []error | ||
| bidderResponse := adapters.NewBidderResponseWithBidsCapacity(len(bidResponse.SeatBid[0].Bid)) |
There was a problem hiding this comment.
I suggest ensuring there is at least one seatbid before attempting to access the first element.
Something like:
if len(bidResponse.SeatBid) == 0 {
return nil, nil
}
or
if len(bidResponse.SeatBid) == 0 {
return nil, []error{&errortypes.BadServerResponse{
Message: "Empty SeatBid array",
}}
}
depending on what makes sense for you.
| if len(bidResponse.SeatBid) == 0 || len(bidResponse.SeatBid[0].Bid) == 0 { | ||
| return nil, nil | ||
| } |
There was a problem hiding this comment.
I think this can be deleted. I suggested a check above to ensure there is a seat bid before sizing the bidder response.
There was a problem hiding this comment.
If the server returns a valid 200 response with an empty seatbid array, this panics at runtime. The empty-check must come before SeatBid[0] is indexed. This is likely the same issue flagged by reviewer @bsardo.
| } | ||
|
|
||
| var errs []error | ||
| bidderResponse := adapters.NewBidderResponseWithBidsCapacity(len(bidResponse.SeatBid[0].Bid)) |
There was a problem hiding this comment.
Please also cover the new logic I suggested above with a supplemental JSON test.
|
|
||
| if len(request.Imp) > 0 { | ||
| var bidderExt adapters.ExtImpBidder | ||
| if err := jsonutil.Unmarshal(request.Imp[0].Ext, &bidderExt); err != nil { |
There was a problem hiding this comment.
A failed first unmarshal leaves bidderExt.Bidder as nil, then the second unmarshal proceeds on bad state. Both unmarshal errors should return early.
| } | ||
|
|
||
| var ext openrtb_ext.ExtImpSynapseHX | ||
| if err := json.Unmarshal(bidderExt.Bidder, &ext); err != nil { |
There was a problem hiding this comment.
Should consistently use jsonutil.Unmarshal throughout.
|
|
||
| type ExtImpSynapseHX struct { | ||
| TenantID string `json:"tenantId"` | ||
| AdUnitID string `json:"adUnitId,omitempty"` |
There was a problem hiding this comment.
ExtImpSynapseHX.AdUnitID is defined and present in the JSON schema (adUnitId), but the adapter never reads or forwards it. Either use it or remove it. Leaving it creates false expectations for publishers.
| if buildErr != nil { | ||
| t.Fatalf("Builder returned unexpected error %v", buildErr) | ||
| } | ||
| adapterstest.RunJSONBidderTest(t, "synapseHXtest", bidder) |
There was a problem hiding this comment.
The convention in this repo is to pass the adapter directory name (e.g., "synapseHX"), not "synapseHXtest". This may cause the test to silently look in the wrong directory.
There was a problem hiding this comment.
Thank you.
We checked this across the repository and based on the existing usage examples it does not match with your suggestion - here are a few screenshots from the repo for reference. The same behavior also seems to be aligned with the official documentation here: https://docs.prebid.org/prebid-server/developers/add-new-bidder-go.html#test-your-adapter
Please, let us know your opinion. On our side, we have ready-to-push change to address this.


| "github.com/prebid/prebid-server/v4/openrtb_ext" | ||
| ) | ||
|
|
||
| func TestValidParams(t *testing.T) { |
There was a problem hiding this comment.
As flagged by @bsardo, tests are missing for:
- Empty seatbid array in response
- request.Imp is empty
- Unmarshal failure on impression ext
- getMediaTypeForBid with no mtype and no bid.ext
The reported 76.9% coverage on getMediaTypeForBid confirms these gaps.
There was a problem hiding this comment.
Tests were added.
Code coverage summaryNote:
synapseHXRefer here for heat map coverage report |
Code coverage summaryNote:
synapseHXRefer here for heat map coverage report |
Docs PR - prebid/prebid.github.io#6581
Related Changes