Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Native Bid Response could not be parsed #43

Closed
bschev opened this issue Jun 19, 2015 · 3 comments
Closed

Native Bid Response could not be parsed #43

bschev opened this issue Jun 19, 2015 · 3 comments

Comments

@bschev
Copy link

bschev commented Jun 19, 2015

Hi,

until now I used version 0.8.1 without problems, with all higher versions I get an exception while reading the following native response:

{
  "id": "123456",
  "seatbid": [
    {
      "seat": "987654",
      "bid": [
        {
          "id": "1",
          "impid": "1",
          "price": 0.345,
          "nurl": "http://someurl.com/win/123456?price=${AUCTION_PRICE}",
          "adm": "{\"native\": {\"ver\":1, \"assets\": [{\"id\": 1,\"title\": {\"text\": \"title text\"}},{\"id\": 2,\"img\": {\"url\": \"http://mainimage.com\", \"w\":300, \"h\":400}},{\"id\": 3,\"img\": {\"url\": \"http://logoimage.com\", \"w\":100, \"h\":100}},{\"id\": 4,\"data\": {\"value\": \"caption text\"}},{\"id\": 5,\"data\": {\"value\": \"brand name\"}}], \"link\" : {\"url\":\"http://destination.com\", \"clicktrackers\":[\"http://clktracker.com/clk\"]}, \"imptrackers\" : [\"http://url.com/123\", \"http://url.com/345\"]}}"
        }
      ]
    }
  ]
}

Exception:

com.google.protobuf.UninitializedMessageException: Message missing required fields: link
    at com.google.protobuf.AbstractMessage$Builder.newUninitializedMessageException(AbstractMessage.java:372)
    at com.google.openrtb.OpenRtbNative$NativeResponse$Builder.build(OpenRtbNative.java:14273)
    at com.google.openrtb.json.OpenRtbNativeJsonReader.readNativeResponse(OpenRtbNativeJsonReader.java:310)
    at com.google.openrtb.json.OpenRtbNativeJsonReader.readNativeResponse(OpenRtbNativeJsonReader.java:303)

The adm value seems to be the problem, expected is {"ver":1, "assets":[...]} and not {"native": {"ver":1, "assets":[...]}}.

If a response is created with the OpenRtb.BidResponse.Builder the native attribute is also not created.

Is that the desired behaviour?

If I understand the OpenRTB Native Ads Specification correctly, there should be a native attribute in the adm JSON. The example Bid Response JSON in the specification also includes the native. Or do I get it wrong?

@opinali
Copy link
Contributor

opinali commented Jun 20, 2015

This is not the desired behavior, it's a bug, it seems the library never supported the root native field. I think the reason this kind-of-worked before is that the parser would ignore things it didn't understood in the start of the stream, but this won't happen anymore in the current parser which was improved to scan the document more reliably in several ways. But it's a good thing that this uncovered an old bug. Expect a fix and release with this fix early next week...

@opinali
Copy link
Contributor

opinali commented Jun 21, 2015

Please test the current code just committed to master.

@bschev
Copy link
Author

bschev commented Jun 22, 2015

I tested the new code, it works.
Thank you for the fast fix!

@opinali opinali closed this as completed Jul 18, 2015
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

2 participants