Shopify / slate

Slate is a toolkit for developing Shopify themes. It's designed to assist your workflow and speed up the process of developing, testing, and deploying themes.
https://shopify.github.io/slate
MIT License
1.28k stars 363 forks source link

bugsnag broke script on product page #1097

Closed kochnevalex closed 3 years ago

kochnevalex commented 4 years ago

I use theme slate v1.

this script plugs bugsnag //d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js after this script includes. All scripts don't work on shop //d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js this script broke theme's script if it is loaded before theme scripts. i found out that when bugsnag is loaded before theme's script, all theme's scripts on product page don't work https://prnt.sc/sdeger it's not my script, i found an article that's shopify's script https://www.bugsnag.com/customers/shopify Please help how to remove bugsnag Is it shopify's script on in theme?
kochnevalex commented 4 years ago

it happens when on product page exist video tag

clin407 commented 4 years ago

@kochnevalex did you ever figure out a workaround for this? I noticed the same thing (for me it's hijacking the click events so my sliders will sometimes not work)

kochnevalex commented 4 years ago

@clin407 i did not find issue. Now i just remove from product page. Shopify support can't give me answer how to remove bugsnag from store

calebcurtis8 commented 3 years ago

I was able to resolve this by preventing bugnsag from loading with https://github.com/snipsco/yett In of layout.liquid before {{content_for_header}}

{% if product %}
  {% comment %}blocks bugsnag from loading on product pages so we can load media objects and keep our scripts at the end of the page {% endcomment %}
  <script>
      window.YETT_BLACKLIST = [
        /bugsnag\.min\.js/,
      ]
    </script>

  <script src="https://unpkg.com/yett"></script>
  {% endif %}
mrobit commented 3 years ago

Hard to believe that this would be a Slate theme issue – this script is going to be loaded regardless. Really odd that Shopify hasn't done anything about this. Regardless, @calebcurtis8 your solution saved me. Thank you!

tommypepsi commented 3 years ago

If anyone's have this issue, I managed to pinpoint the issue to a "beta" flag inside an array in the "content_for_header". My guess is that shopify added this with the addition of videos and 3d object in products media for monitoring this new feature. For me bugsnag was randomly overwriting setTimout which was breaking some features and affecting performance.

My solution was to remove the flag in liquid like that:

{% capture shopify_content_for_header %}
    {{ content_for_header }}
{% endcapture %}
{{ shopify_content_for_header | replace: ',"rich-media-storefront-analytics"', '' | replace: '"rich-media-storefront-analytics"', '' }}
lmartins commented 3 years ago

Not using Slate, and spent the entire day trying to understand why I was running into issues with bugsnag on my site. @calebcurtis8 solution also did the trick for me. Thank you! What a pain.

tylerrowsell commented 3 years ago

We have removed bugsnag from the media-analytics script. It should be on the cdn within the next hour.