Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imp.ext.prebid.adunitcode is removed from imp.ext.prebid when rebuildImp is called #4060

Closed
Abyfall opened this issue Nov 20, 2024 · 2 comments
Assignees

Comments

@Abyfall
Copy link
Contributor

Abyfall commented Nov 20, 2024

Hi guys, after upgrading to prebid server 3.1 we noticed that we couldn't retrieve the adUnitCode from imp.ext.prebid.adunitcode anymore.

It still present in the Prebid Server ORTB2 Extension Summary section of the doc so I assume it's a bug from prebid-server.

I tracked down the issue to the rebuildImpExt() & (e *ImpExt) marshal()

func (e *ImpExt) marshal() (json.RawMessage, error) {
if e.prebidDirty {
if e.prebid != nil {
prebidJson, err := jsonutil.Marshal(e.prebid)
if err != nil {
return nil, err
}
if len(prebidJson) > jsonEmptyObjectLength {
e.ext[prebidKey] = json.RawMessage(prebidJson)
} else {
delete(e.ext, prebidKey)
}
} else {
delete(e.ext, prebidKey)
}
e.prebidDirty = false
}

Those will recreate the imp.ext.prebid with the help of ExtImpPrebid struct. But as this struct doesn't contains the adunitcode, the value which was originally set is dropped.

This issue seems to exist since some time but we didn't face it before because we always had e.prebidDirty == false preventing thhe call to rebuildImpExt. This isn't the case anymore since the introduction of moveRewardedFromPrebidExtTo26 which always sets prebidDirty if prebid object was found in imp.ext.

func moveRewardedFromPrebidExtTo26(i *ImpWrapper) {
// read and clear prebid ext
impExt, _ := i.GetImpExt()
rwddPrebidExt := (*int8)(nil)
if p := impExt.GetPrebid(); p != nil {
rwddPrebidExt = p.IsRewardedInventory
p.IsRewardedInventory = nil
impExt.SetPrebid(p)
}

As a side note I think we should change moveRewardedFromPrebidExtTo26
if p := impExt.GetPrebid(); p != nil {

to also check if p.IsRewardedInventory is not nil before replacing the whole prebid field and flagging it as dirty

@bretg
Copy link
Contributor

bretg commented Nov 20, 2024

Thanks for the bug report @Abyfall. A community PR would be welcomed here.

@Abyfall
Copy link
Contributor Author

Abyfall commented Nov 20, 2024

Thanks @bretg I just pushed a PR that solves this issue

@Abyfall Abyfall closed this as completed Nov 22, 2024
@github-project-automation github-project-automation bot moved this from Ready for Dev to Done in Prebid Server Prioritization Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

3 participants