question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IE 11 - fetch undefined

See original GitHub issue

I had to include the source code in my project and modified OidcConfigService to fix this problem. I also had to import { Buffer } from ‘buffer’; into TokenHelperService as well as add (window as any).global = window; to polyfills.ts . Now I am getting a separate, likely un-related to this library, error. Same as this person.. How fun it is to work with IE. My project is based off of this one

import { HttpClient } from '@angular/common/http';
import { EventEmitter, Injectable, Output } from '@angular/core';

@Injectable()
export class OidcConfigService {

    constructor(private http: HttpClient) { }

    @Output()
    onConfigurationLoaded = new EventEmitter<boolean>();
    clientConfiguration: any;
    wellKnownEndpoints: any;

    load(configUrl: string) {
        try {

            this.http.get(configUrl).subscribe((clientConfig: any) => {
                this.clientConfiguration = clientConfig;
                this.http.get(`${clientConfig.stsServer}/.well-known/openid-configuration`).subscribe((data) => {
                    this.wellKnownEndpoints = data;
                    this.onConfigurationLoaded.emit(true);
                });
            });

        } catch (err) {
            console.error(
                `OidcConfigService 'load' threw an error on calling ${configUrl}`,
                err
            );
            this.onConfigurationLoaded.emit(false);
        }
    }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
JohnGalt1717commented, Aug 22, 2018

You’ll need a fetch polyfill likely. Per the documentation:

IE 11, Edge fetch For the fetch to work, or the app init, you need to include the isomorphic-fetch package. https://www.npmjs.com/package/isomorphic-fetch And add this to the polyfills /** Workaround for IE11 and polyfill problem */ import ‘isomorphic-fetch’;

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting fetch is undefined in internet explorer 11?
I am coming to an issue where my code below, says that 'fetch' is undefined in internet explorer 11. I am using the...
Read more >
JavaScript runtime error: 'fetch' is undefined in IE11 #7370
Hi, i get this error in IE11: 'fetch' is undefined. On this line: var f$1 = fetch; [pouchdb-7.0.0.js] Line 4838
Read more >
How to polyfill JavaScript fetch function for Internet Explorer
For fetch to work on Internet Explorer, we need to add two polyfills: Promise polyfill - remember, fetch uses promises; Fetch polyfill. // ......
Read more >
[AG-Grid] JavaScript error in IE11: 'fetch' is undefined
It seems this component is using Fetch API to retrieve data from the server (in one of the possible implementations to render data...
Read more >
On IE11 getting error SCRIPT5009: 'fetch' is undefined
I'm getting an error when trying to open my app in IE v11.0.90. When I check the console window it shows the following...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found