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.

"'Promise' is undefined" in IE11

See original GitHub issue

I’m testing the pnp.js of the latest PnP-JS-Core, using an Install and Use example

The example includes the use of promise. The instructions say that this will fail in IE11 unless I add the es6-promise polyfill and the fetch polyfill and include them in the example.

So I did, but in IE11, when invoking the invocation of “then”:

$pnp.sp.web.select("Title").get()
.then(function (data) {
    document.getElementById("main").innerText = 'Web title: ' + data.Title;
})
.catch(function (ex) {
    document.getElementById("main").innerText = 'Exception: ' + ex;
});

still fails with the exception: “‘Promise’ is undefined”.

Any suggestions why that might be?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ray007commented, Oct 24, 2018

Seems I maybe do not have the latest version here, “catch” needs to be a quoted property: Promise.prototype['catch'] = ...

0reactions
daryllabarcommented, Oct 23, 2018

I’m getting an error in IE 11: Expected identifier (1075,21) IE 11 has a bug in it’s JS engine (at least on my machine it does) where catch is not interpreted as a function name, but as a try{}catch(){} and is failing…

	Promise.prototype.catch = function _catch(onRejection) {
		return this.then(null, onRejection);
	};

If I fix that error, I also get the same error on the finally.

Maybe this is due to compatibility mode? Am I doing something wrong?

Looks like this was an IE Compatibility issue. The minified or the es6-promises actually does have the [“catch”] and [“finally”] values defined correctly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Error Promise is undefined in IE11 - Stack Overflow
I am converting React code to typescript, target in tsconfig is es5. on running in IE 11 i get ...
Read more >
'Promise' is undefined in Internet Explorer (IE 11) - Syncfusion
We suspect that you haven't referred the ES6 Promise polyfill script in your html page which cause this issue in IE11 browser.
Read more >
"'Promise' is undefined" error in IE11 even though targeting ES5
An interesting counter-example to Promise not working, BTW, is that Symbol does seem to get polyfilled (at least, I get no error in...
Read more >
IE11 Dialog Promise Undefined - The Aurelia Discourse
I'm in the process of updating an existing app using (Aurelia Framework 1.1.4) to the latest version of Aurelia.
Read more >
'Promise' is undefined in IE11 WordPress
I have used this plugin to create popups in the Divi website I have built: https://wordpress.org/plugins/popups-for-divi/. The popups were not opening in IE...
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