# Amazon onebox fails on my site, but works here

**URL:** <https://meta.discourse.org/t/amazon-onebox-fails-on-my-site-but-works-here/41609>\
**Category:** Bug\
**Created:** [2016 年 3 月 27 日午前 2:25 UTC](https://meta.discourse.org/t/amazon-onebox-fails-on-my-site-but-works-here/41609 "2016-03-27T02:25:35Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)\
**Post date:** [2016 年 3 月 28 日午前 5:56 UTC](https://meta.discourse.org/t/amazon-onebox-fails-on-my-site-but-works-here/41609/16 "2016-03-28T05:56:57Z")

</div>

This is a super weird bug…

```plaintext
(byebug) Nokogiri::HTML(open(url, {read_timeout: timeout}.merge(http_params)).read).css("#main-image").first.attributes.keys
["alt", "src", "data-fling-asin", "data-fling-refmarker", "data-midres-replacement", "onload", "class", "id", "data-a-image-name", "data-a-hires"]
(byebug) Nokogiri::HTML(open(url, {read_timeout: timeout}.merge(http_params)).read).css("#main-image").first.attributes.keys
["alt", "src", "data-fling-asin", "data-fling-refmarker", "data-hires-replacement", "onload", "data-a-image-name", "class", "id", "data-a-dynamic-image", "style"]
(byebug) Nokogiri::HTML(open(url, {read_timeout: timeout}.merge(http_params)).read).css("#main-image").first.attributes.keys
["alt", "src", "data-fling-asin", "data-fling-refmarker", "data-hires-replacement", "onload", "data-a-image-name", "class", "id", "data-a-dynamic-image", "style"]
(byebug) Nokogiri::HTML(open(url, {read_timeout: timeout}.merge(http_params)).read).css("#main-image").first.attributes.keys
["alt", "src", "data-fling-asin", "data-fling-refmarker", "data-hires-replacement", "onload", "data-a-image-name", "class", "id", "data-a-dynamic-image", "style"]
(byebug) Nokogiri::HTML(open(url, {read_timeout: timeout}.merge(http_params)).read).css("#main-image").first.attributes.keys
["alt", "src", "data-fling-asin", "data-fling-refmarker", "data-hires-replacement", "onload", "data-a-image-name", "class", "id", "data-a-dynamic-image", "style"]
(byebug) Nokogiri::HTML(open(url, {read_timeout: timeout}.merge(http_params)).read).css("#main-image").first.attributes.keys
["alt", "src", "data-fling-asin", "data-fling-refmarker", "data-midres-replacement", "onload", "class", "id", "data-a-image-name", "data-a-hires"]
(byebug) 

```

For some reason, the attributes in the image keeps changing. Note how it alternates between `[data-a-hires, data-hires-replacement]`and `[data-a-dynamic-image, data-midres-replacement]`

Why? I’m not sure and I’ve spent too much time trying to figure out why. I did manage to reproduce the different image tag attributes in my browser by loading the same product URL normally and in incognito mode.

I’ll wait a day or two before merging my PR below to see if anyone might know why…

[https://github.com/discourse/onebox/pull/318](https://github.com/discourse/onebox/pull/318)

---

_[View the full topic](https://meta.discourse.org/t/amazon-onebox-fails-on-my-site-but-works-here/41609)._
