Cannot read property 'then' of undefined
See original GitHub issueCurrent behavior
I’m getting a lot of Sentry error reports on 3528:48
_createClass(SweetAlert, [{
key: "then",
value: function then(onFulfilled) {
var promise = privateProps.promise.get(this); // <-- This line, specifically the 'this'
return promise.then(onFulfilled);
}
}, {
key: "finally",
value: function _finally(onFinally) {
I’m trying to reproduce it myself and so far have been unable to do so. It seems this crash can happen as soon as loading the page.
Expected behavior
I would expect the code to handle when promise is undefined. Perhaps there’s a race condition happening here?
Live demo
I’ll just note again I haven’t been able to reproduce it myself, so I would love some advice on what I could do to perhaps test this part of the code and reproduce the issue I’m seeing.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'then' of undefined
TypeError : Cannot read property 'then' of undefined when calling a Django service using AngularJS. If you are calling a Python service, ...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
What Causes TypeError: Cannot Read Property of Undefined. Undefined means that a variable has been declared but has not been assigned a value....
Read more >Cannot read property 'then' of undefined" when mocking ...
Describe the bug I have the following interface in TypeScript: interface Something { getValueAsync: () => Promise } I'm trying to create a ......
Read more >Cannot read property 'then' of undefined - Promise - Reddit
I have a function to fetch some data. The last block is also inside a async block. Now the question is why is...
Read more >Jamming - TypeError: Cannot read property 'then' of undefined
When you see a TypeError: Cannot read property 'whatever' of undefined, the place to start looking is where 'whatever' is attached to should ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah I’ll say the solution was to call the function only on views that exist and close this out.
Got some extra help and found that the issue has something to do with the page’s navigation messing with the weakmap promise implementation.