Polyfill-service: V2 No longer works on IE (possibly other browsers)

Created on 18 Mar 2019  路  30Comments  路  Source: Financial-Times/polyfill-service

Bug Report

What

V2 is currently failing to return any polyfills for IE11.

Details

Noticed some sites stoped working on IE. Console is returning a bunch of errors about objects not supporting specific properties or methods. Checked the polyfill (v2) and it is no longer returning any polyfills for IE11.

This is my query string:
https://cdn.polyfill.io/v2/polyfill.min.js?features=default,es5,es6,array.prototype.includes

Additional information

This is going to effect several of my production sites. I really hope this can be addressed quickly

Most helpful comment

@munter The fix is already in a PR, just waiting for CI to give the green light 馃憤

@chaddugas v2 and v3 run off of the same codebase, v2 actually uses the public v3 api, which means fixing the v3 api will fix the v2 api as well. I support both of them and will do for the long foreseeable future.

All 30 comments

IE11 still gets polyfills on v2 -- https://cdn.polyfill.io/v2/polyfill.min.js?features=default,es5,es6,array.prototype.includes&ua=ie/11

I'm not sure what issue you are seeing, could you please post a jsbin.com link which reproduces the issue for me?

@JakeChampion ,
Here is a jsbin that shows what is being returned if you open it in IE11:
https://jsbin.com/rofonilafi/edit?html,output

Also here is a screenshot showing the results that I get in IE (you can see that you get the wrappers, but it has this comment: /* No polyfills found for current settings */ - there should definitely be polyfills for es5, es6, and array.pototype.includes or IE11):
Screen Shot 2019-03-18 at 10 15 29 AM

@JakeChampion Is there something I need to do to re-open the issue? Or should I create a new issue?

Which version of IE11 are you seeing the issue in? I've tested a few different IE11s and they are all working correctly.

Could you post the full useragent string for the browser you are seeing this issue in?

bs_win7_IE_11 0

@JakeChampion here you go:
image

Could you post the user agent string as text please? I would like to use it for some further debugging :-)

Yup no problem, it's in the screenshot but here is the actual text:

Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; Tablet PC 2.0; rv:11.0) like Gecko

Hmm, using the user-agent you posted I can see that it does get parsed as ie 11, you can test that out by adding the querystring parameter ua with the user-agent string as the value, like so:
https://polyfill.io/v2/polyfill.js?ua=Mozilla/5.0%20(Windows%20NT%2010.0;%20WOW64;%20Trident/7.0;%20.NET4.0C;%20.NET4.0E;%20Tablet%20PC%202.0;%20rv:11.0)%20like%20Gecko

You should see the comment at the top of the response says UA detected: ie/11.0.0

In your screenshot I see the comment says: UA detected: other/0.0.0, which makes me think something else is going on 馃

Even with that URL I am still getting: UA detected: other/0.0.0 (unknown/unsupported; using policy unknown=ignore).

I have tried this on a couple computers and Im getting the same thing

@JakeChampion let me know if there is anything else you need from me

We've also been intermittently seeing this issue on both MacOS Safari 12.0.3 and Windows 10 IE11 (could be more browsers affected, but we only use polyfills required by Safari and IE).

It doesn't happen every time or on every persons machine, so it seems like it could be certain servers handling it and others not doing.

On the machines where we are seeing the error we have directly loaded the polyfill.io link in that browser and had no polyfills returned.

If you encode the query part of the url, it works correctly in IE11:
https://cdn.polyfill.io/v2/polyfill.min.js?features%3Ddefault%2Ces5%2Ces6%2Carray.prototype.includes

I would like to note that we experienced the same issue in a production application yesterday, but it wasn't until we found this closed issue that @AleksueiR and our team were able to identify the fix.

At some point there has been a shift that now requires the URL to be encoded for v2 to work. This is not the case with v3. I would suggest NOT closing issues so aggressively in the future @JakeChampion (I admire the ruthlessness however). Thanks.

@JakeChampion given that this is an ongoing issue (and is happening to multiple people) is there a way to reopen the issue?

@AleksueiR That doesn't actually work because the querystring would no longer contain a parameter called features. It would has a querystring parameter called features=default,es5,es6,array.prototype.includes which has an empty string as it's value.
image
image

We can also show this is the case for our service by making a http request with the header fastly-debug set which enables extra debug information to be returned.

Using HTTPie as an example:

http 'https://cdn.polyfill.io/v2/polyfill.min.js?features%3Ddefault%2Ces5%2Ces6%2Carray.prototype.includes%26ua%3Die%2F11' 'fastly-debug:1'

The response headers now has a header named Debug-VCL-Route which displays what the actual URL was that got forwarded to the origin servers. For the request above it was this:
Debug-VCL-Route: VCL_RECV,VCL_HASH,VCL_HIT(origami-polyfill-service-eu.herokuapp.com/v3/polyfill.min.js?callback=&compression=gzip&excludes=&features=default&flags=&rum=0&ua=other%2F0.0.0&unknown=ignore&version=3.25.1),VCL_DELIVER. We can see the features parameter only has default and not the other features, this is because there was no actual features query parameter being sent since it was percent/url encoded.

image

We are encountering the same issue as described.
With the following curl (copied as curl from chrome dev tools)

curl "https://cdn.polyfill.io/v2/polyfill.js?features^%^3Ddefault^%^2Ces5^%^2Ces6^%^2Carray.prototype.includes" -H "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36"

We get the following response:

/* Polyfill service v3.25.1
 * For detailed credits and licence information see https://github.com/financial-times/polyfill-service.
 *
 * UA detected: other/0.0.0 (unknown/unsupported; using policy `unknown=ignore`)
 * Features requested: default
 *  */

(function(undefined) {

/* No polyfills found for current settings */

})
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});


Here is the complete HAR

{
  "log": {
    "version": "1.2",
    "creator": {
      "name": "WebInspector",
      "version": "537.36"
    },
    "pages": [
      {
        "startedDateTime": "2019-03-19T14:42:22.773Z",
        "id": "page_2",
        "title": "https://cdn.polyfill.io/v2/polyfill.min.js?features%3Ddefault%2Ces5%2Ces6%2Carray.prototype.includes",
        "pageTimings": {
          "onContentLoad": 500.04199997056276,
          "onLoad": 561.1209999769926
        }
      }
    ],
    "entries": [
      {
        "startedDateTime": "2019-03-19T14:42:22.770Z",
        "time": 20.281000004615635,
        "request": {
          "method": "GET",
          "url": "https://cdn.polyfill.io/v2/polyfill.min.js?features%3Ddefault%2Ces5%2Ces6%2Carray.prototype.includes",
          "httpVersion": "http/2.0",
          "headers": [
            {
              "name": ":method",
              "value": "GET"
            },
            {
              "name": ":authority",
              "value": "cdn.polyfill.io"
            },
            {
              "name": ":scheme",
              "value": "https"
            },
            {
              "name": ":path",
              "value": "/v2/polyfill.min.js?features%3Ddefault%2Ces5%2Ces6%2Carray.prototype.includes"
            },
            {
              "name": "pragma",
              "value": "no-cache"
            },
            {
              "name": "cache-control",
              "value": "no-cache"
            },
            {
              "name": "upgrade-insecure-requests",
              "value": "1"
            },
            {
              "name": "user-agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36"
            },
            {
              "name": "accept",
              "value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
            },
            {
              "name": "referer",
              "value": "https://github.com/Financial-Times/polyfill-service/issues/1922"
            },
            {
              "name": "accept-encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "accept-language",
              "value": "en-US,en;q=0.9,da-DK;q=0.8,da;q=0.7"
            }
          ],
          "queryString": [
            {
              "name": "features%3Ddefault%2Ces5%2Ces6%2Carray.prototype.includes",
              "value": ""
            }
          ],
          "cookies": [],
          "headersSize": -1,
          "bodySize": 0
        },
        "response": {
          "status": 200,
          "statusText": "",
          "httpVersion": "http/2.0",
          "headers": [
            {
              "name": "status",
              "value": "200"
            },
            {
              "name": "cache-control",
              "value": "public, s-maxage=31536000, max-age=604800, stale-while-revalidate=604800, stale-if-error=604800"
            },
            {
              "name": "content-type",
              "value": "text/javascript; charset=utf-8"
            },
            {
              "name": "content-encoding",
              "value": "br"
            },
            {
              "name": "etag",
              "value": "W/\"7e-Lg1mQtlDtrujPBTtidtsoNmOeEQ\""
            },
            {
              "name": "server-timing",
              "value": "HIT-CLUSTER, fastly;desc=\"Edge time\";dur=1"
            },
            {
              "name": "server-timing",
              "value": "HIT, fastly;desc=\"Edge time\";dur=2"
            },
            {
              "name": "request_came_from_shield",
              "value": "AMS"
            },
            {
              "name": "x-content-type-options",
              "value": "nosniff"
            },
            {
              "name": "strict-transport-security",
              "value": "max-age=31536000; includeSubdomains; preload"
            },
            {
              "name": "referrer-policy",
              "value": "origin-when-cross-origin"
            },
            {
              "name": "timing-allow-origin",
              "value": "*"
            },
            {
              "name": "normalized-user-agent",
              "value": "chrome/72.0.0"
            },
            {
              "name": "detected-user-agent",
              "value": "Chrome/72.0.3626"
            },
            {
              "name": "accept-ranges",
              "value": "bytes"
            },
            {
              "name": "date",
              "value": "Tue, 19 Mar 2019 14:42:22 GMT"
            },
            {
              "name": "age",
              "value": "336448"
            },
            {
              "name": "vary",
              "value": "User-Agent, Accept-Encoding"
            },
            {
              "name": "content-length",
              "value": "126"
            }
          ],
          "cookies": [],
          "content": {
            "size": 222,
            "mimeType": "text/javascript"
          },
          "redirectURL": "",
          "headersSize": -1,
          "bodySize": -1,
          "_transferSize": 292
        },
        "cache": {},
        "timings": {
          "blocked": 3.174999990474433,
          "dns": -1,
          "ssl": -1,
          "connect": -1,
          "send": 0.15800000000000003,
          "wait": 16.01299999592453,
          "receive": 0.9350000182166696,
          "_blocked_queueing": 2.4219999904744327
        },
        "serverIPAddress": "151.101.38.109",
        "_initiator": {
          "type": "other"
        },
        "_priority": "VeryHigh",
        "_resourceType": "document",
        "connection": "1549928",
        "pageref": "page_2"
      }
    ]
  }
}

We're encountering the same issue using Chrome 72.0.3626.121;

https://cdn.polyfill.io/v2/polyfill.js?features=default,fetch,IntersectionObserver returns

/* Polyfill service v3.25.1
 * For detailed credits and licence information see https://github.com/financial-times/polyfill-service.
 * 
 * UA detected: other/0.0.0 (unknown/unsupported; using policy `unknown=ignore`)
 * Features requested: IntersectionObserver,default,fetch
 *  */

(function(undefined) {

/* No polyfills found for current settings */

})
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});

Using v3 instead for the same features returns the all the polyfills as if using &flags=always, but there is no indication wether the UA was correctly detected or not (I would think not considering the polyfills were all included).

We get the exact same behavior using Internet Explorer 11 (11.648.17134.0).

@hklsiteimprove That also is not a valid querystring for the polyfill-service.

for (const [key, value] of new URL('https://cdn.polyfill.io/v2/polyfill.min.js?features%3Ddefault%2Ces5%2Ces6%2Carray.prototype.includes').searchParams) {
    console.log(`key: "${key}" value: "${value}"`); // key: "features=default,es5,es6,array.prototype.includes" value: ""
}

image

Did that URL used to work for you?

@jacobgunnarsson I've been able to replicate that one! Excellent, I can look into fixing this for everyone now :-)

The issue is that sometimes Fastly will run the VCL for this service multiple times and we had a part of the VCL which was not idempotent, I've submitted a PR to rectify this --> https://github.com/Financial-Times/polyfill-service/pull/1930

@JakeChampion Here's your smallest possible reproduction: https://cdn.polyfill.io/v2/polyfill.js

/* Polyfill service v3.25.1
 * For detailed credits and licence information see https://github.com/financial-times/polyfill-service.
 * 
 * UA detected: other/0.0.0 (unknown/unsupported; using policy `unknown=ignore`)
 * Features requested: default
 *  */

(function(undefined) {

/* No polyfills found for current settings */

})
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});

Chrome 72: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36

@JakeChampion thank you for working on this.

Hoping you can answer this or point me in the right direction, but I'm curious what the timeline for support of v2 will be now that v3 has been released?

@munter The fix is already in a PR, just waiting for CI to give the green light 馃憤

@chaddugas v2 and v3 run off of the same codebase, v2 actually uses the public v3 api, which means fixing the v3 api will fix the v2 api as well. I support both of them and will do for the long foreseeable future.

@JakeChampion, Thanks for solving. We currently experiencing the same with our (in production) webshop.

The deployment is happening right now @martivel, it should be live around all our server globally in 30 seconds

This is now live on polyfill.io and looks to be fixed. I have also added a test to ensure this never regresses in the future.

@JakeChampion thanks again for fixing this. It's appreciated. It looks like my browsers are starting to load the correct polyfills again.

@JakeChampion thank you for your work!

Can confirm the problems we were experiencing are fixed.

Same here, all fixed. Thanks @JakeChampion

Thank you for the very quick turnaround time on this. This was fixed faster than we could have rolled out a fix of our own code base

Was this page helpful?
0 / 5 - 0 ratings