Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

billing_id in openrtb json is String and not Long #110

Closed
mnouh opened this issue Apr 11, 2017 · 6 comments
Closed

billing_id in openrtb json is String and not Long #110

mnouh opened this issue Apr 11, 2017 · 6 comments

Comments

@mnouh
Copy link

mnouh commented Apr 11, 2017

Hi,

Seeing that billing_id is a String in the OpenRTB json request. However the ImpExtReader is expecting that as a Long.
https://developers.google.com/ad-exchange/rtb/openrtb-guide

Getting the below exception:

com.fasterxml.jackson.core.JsonParseException: Current token (VALUE_STRING) not numeric, can not use numeric value accessors at [Source: org.glassfish.grizzly.utils.BufferInputStream@4ecbbe0b; line: 1, column: 163] at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1419) ~[jackson-core-2.4.3.jar:2.4.3] at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:508) ~[jackson-core-2.4.3.jar:2.4.3] at com.fasterxml.jackson.core.base.ParserBase._parseNumericValue(ParserBase.java:748) ~[jackson-core-2.4.3.jar:2.4.3] at com.fasterxml.jackson.core.base.ParserBase.getLongValue(ParserBase.java:619) ~[jackson-core-2.4.3.jar:2.4.3] at com.google.doubleclick.openrtb.json.ImpExtReader.read(ImpExtReader.java:46) ~[?:?] at com.google.doubleclick.openrtb.json.ImpExtReader.read(ImpExtReader.java:35) ~[?:?] at com.google.openrtb.json.OpenRtbJsonExtComplexReader.readSingle(OpenRtbJsonExtComplexReader.java:93) ~[?:?]

{ "id": "V+u4DAAI8CEKG+PVxAwrsA", "imp": [ { "id": "1", "banner": { "w": 320, "h": 480, "pos": 1, "api": [ 3, 5 ], "wmax": 360, "hmax": 640, "wmin": 320, "hmin": 280 }, "instl": 1, "tagid": "1", "bidfloor": 0.01, "bidfloorcur": "USD", "ext": { "billing_id": [ "12345678901" ], "publisher_settings_list_id": [ "12345678901234567890" ], "allowed_vendor_type": [ 113 ] } } ], "app": { "name": "Super Speed VPN", "bundle": "com.example.free.vpn.proxy", "publisher": { "id": "1" }, "content": { "url": "https://play.google.com/store/apps/details?id=com.example.free.vpn.proxy", "contentrating": "DV-G", "userrating": "4.2", "language": "en" } }, "device": { "ua": "Mozilla/5.0...(Mobile; afma-sdk-a-v9683236.8115000.2)", "ip": "123.456.789.0", "geo": { "country": "FRA", "utcoffset": 180 }, "make": "alcatel", "model": "5022d", "os": "android", "osv": "5.1", "devicetype": 4, "ifa": "ec162290-a098-43ac-9fac-411861ba2b1a", "w": 360, "h": 640, "pxratio": 2 }, "user": { "id": "CAESEPfSJVjdc8Mx2U_Dd3fQqvM" }, "cur": [ "USD" ] }

@opinali
Copy link
Contributor

opinali commented Apr 12, 2017

Thanks for this report -- this is a bug indeed, what happens is that DoubleClick's billing_id is a long so this code needs to make a conversion but it's doing it wrong, it should be using getValueAsLong() instead of getLongValue(). Will fix this immediately.

@mnouh
Copy link
Author

mnouh commented Apr 12, 2017

Thank you. There are also other fields in the Imp Ext that have the same issue, publisher list id, etc.

@opinali
Copy link
Contributor

opinali commented Apr 12, 2017

Argh, I see now why this bug wasn't caught by the tests. The billing_id is a long and real-world values are often above JSON/JavasScript's limit of maximum representable integer (2^53 - 1), so JSON serializers often have an extension to quote large integer numbers. We use that in AdX, but we use it only for values above this limit, 12345678901 is not big enough, and we shouldn't have billing_ids that exceed 2^53 so this wouldn't even be a bug technically. But I suppose you maye have some intermediary processing between AdX and your bidder, and some JSON serializers have different behaviors, for one thing even our own public Protobuf 3 will always quote longs. So I'm still going to improve the library to allow quoted longs there, but let me know how are you getting this bid request message, if it's coming straight from AdX I may need to chase that too.

@opinali
Copy link
Contributor

opinali commented Apr 12, 2017

yes, making the same change for publisher_settings_list_id.

@myDisconnect
Copy link

This issue still persists. Steps to reproduce:

  • Receive bid request via PROTOCOL_OPENRTB_PROTOBUF_2_3 protocol.
  • Read received protobuff request to BidRequest object via parseFrom:
    ExtensionRegistry dcExtension = ExtensionRegistry.newInstance(); AdxExt.registerAllExtensions(dcExtension); OpenRtb.BidRequest openRtbRequest = OpenRtb.BidRequest.parseFrom(data, dcExtension);
  • Print received JSON:
    OpenRtbJsonFactory dcJsonFactory = AdxExtUtils.registerAdxExt(OpenRtbJsonFactory.create()); String jsonOutput = dcJsonFactory.newWriter().writeBidRequest(openRtbRequest);

@opinali
Copy link
Contributor

opinali commented Apr 18, 2017

Sorry for the confusion, I had closed the bug but not released the fix yet. I have just pushed the fix to the master repository here, please test again after pulling the latest code from head.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants