# Strange onebox failure due to malformed 404

**URL:** https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310
**Category:** Support
**Tags:** onebox
**Created:** [22 maart 2019 om 09:23 UTC](https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310 "2019-03-22T09:23:52Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [22 maart 2019 om 09:23 UTC](https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310/1 "2019-03-22T09:23:52Z")

</div>

relates to this site:

[https://www.nbcsandiego.com/news/national-international/CVS-to-Sell-CBD-Products-in-800-Stores-in-8-States-507484191.html](https://www.nbcsandiego.com/news/national-international/CVS-to-Sell-CBD-Products-in-800-Stores-in-8-States-507484191.html)

I get a onebox failure in logs:

`Failed to onebox https://www.nbcsandiego.com/news/national-international/CVS-to-Sell-CBD-Products-in-800-Stores-in-8-States-507484191.html unexpected character () at line 9, column 2 [parse.c:704] `

more info:

`REQUEST_URI	/onebox?url=https%3A%2F%2Fwww.nbcsandiego.com%2Fnews%2Fnational-international%2FCVS-to-Sell-CBD-Products-in-800-Stores-in-8-States-507484191.html&refresh=false`

This link previews fine in [iframely](https://iframely.com/embed/https%3A%2F%2Fwww.nbcsandiego.com%2Fnews%2Fnational-international%2FCVS-to-Sell-CBD-Products-in-800-Stores-in-8-States-507484191.html), [facebook](https://developers.facebook.com/tools/debug/sharing/?q=https%3A%2F%2Fwww.nbcsandiego.com%2Fnews%2Fnational-international%2FCVS-to-Sell-CBD-Products-in-800-Stores-in-8-States-507484191.html) etc.

If anyone is interested in pursuing this let me know if you need more info.

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [22 maart 2019 om 09:43 UTC](https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310/2 "2019-03-22T09:43:23Z")

</div>

Feels like something is expecting JSON and getting HTML.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [22 maart 2019 om 09:44 UTC](https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310/3 "2019-03-22T09:44:42Z")

</div>

Yes, I’ve seen a related error. I did try to byebug it through … let me see if I can find that … will update

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [22 maart 2019 om 09:45 UTC](https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310/4 "2019-03-22T09:45:13Z")

</div>

```
2019-03-22 10:42:42 - MultiJson::ParseError - 767: unexpected token at '<head>
<title>404 Not Found</title>
</head><body>
<h1>404 Not Found</h1>
  <p>The provided content is neither a Video Release nor does it contain a Video Release in Related Media.<br>Example Request Format: https://www.nbcnewyork.com/services/oembed/?url=https://www.nbcnewyork.com/sample/path/Sample-Article-Example-12345678.html</p>
</body></html>

      ':
	/Users/joffreyjaffeux/.rubies/ruby-2.6.1/lib/ruby/2.6.0/json/common.rb:156:in `parse'
	/Users/joffreyjaffeux/.rubies/ruby-2.6.1/lib/ruby/2.6.0/json/common.rb:156:in `parse'
	/Users/joffreyjaffeux/.gem/ruby/2.6.1/gems/multi_json-1.13.1/lib/multi_json/adapters/json_common.rb:14:in `load'
	/Users/joffreyjaffeux/.gem/ruby/2.6.1/gems/multi_json-1.13.1/lib/multi_json/adapter.rb:21:in `load'
	/Users/joffreyjaffeux/.gem/ruby/2.6.1/gems/multi_json-1.13.1/lib/multi_json.rb:122:in `load'
	/Users/joffreyjaffeux/Projects/onebox/lib/onebox/oembed.rb:6:in `initialize'

```

> <https://github.com/discourse/onebox/blob/main/lib/onebox/oembed.rb#L5>

We are trying to get oembed content from [CVS to Sell CBD Products in 800 Stores in 8 States – NBC New York](https://www.nbcnewyork.com/services/oembed/?url=https://www.nbcdfw.com/news/health/CVS-to-Sell-CBD-Products-in-800-Stores-in-8-States-507484191.html) which is a 404

The thing is, this URL comes from their page source:

```plaintext
<link rel="alternate" type="application/json+oembed"
    href="https://www.nbcnewyork.com/services/oembed/?url=https://www.nbcsandiego.com/news/national-international/CVS-to-Sell-CBD-Products-in-800-Stores-in-8-States-507484191.html"
    title="CVS to Sell CBD Products in 800 Stores in 8 States - NBC 7 San Diego " />

```

So I would day the bug is from them, not us.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [22 maart 2019 om 09:54 UTC](https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310/5 "2019-03-22T09:54:12Z")

</div>

Thank you, that doesn’t surprise me at all!

Forgive me if I sound stupid here: there’s no way we could make this more resilient and tolerate this as basic goal is to retrieve just title, excerpt, thumbnail, etc.?

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [22 maart 2019 om 09:55 UTC](https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310/6 "2019-03-22T09:55:41Z")

</div>

You can always make things more resilient, proof is: it’s working on iFramely.

Now I don’t know if we want to invest time fixing blatant issues like this one. @zogstrip ?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [22 maart 2019 om 11:40 UTC](https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310/7 "2019-03-22T11:40:28Z")

</div>

> [@j.jaffeux](#):
>
> Now I don’t know if we want to invest time fixing blatant issues like this one. @zogstrip ?

Yeah, nooooo.

They’re sending back the HTTP status code `200` with the HTML content of a `404` on a `JSON` request… 🤦‍♂️

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [22 maart 2019 om 11:41 UTC](https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310/8 "2019-03-22T11:41:50Z")

</div>

FYI I even tried to tell them using their website feedback form … and the submission gets stuck at an unresponsive Captcha dialogue 🤦‍♂️

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [21 april 2019 om 11:41 UTC](https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310/9 "2019-04-21T11:41:54Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
