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.

"TypeError: Cannot read property 'then' of undefined" using 8.0.0-next.12 with latest VS Code stable

See original GitHub issue

@dbaeumer I’m not sure whether this is expected to work yet (using 8.0.0-next.12 from npm with the newly published VS Code stable), but I’m seeing this issue when my server calls showMessage:

[12:39:38 PM] [CI] [Error] TypeError: Cannot read property 'then' of undefined
    at LanguageClient.showNotificationMessage ([/Users/danny/Dev/Dart-Code/node_modules/vscode-languageclient/lib/common/client.js:2256:1]())
    at LanguageClient.error ([/Users/danny/Dev/Dart-Code/node_modules/vscode-languageclient/lib/common/client.js:2246:1]())
    at LanguageClient.handleFailedRequest ([/Users/danny/Dev/Dart-Code/node_modules/vscode-languageclient/lib/common/client.js:2948:1]())
    at [/Users/danny/Dev/Dart-Code/node_modules/vscode-languageclient/lib/common/client.js:1917:1]()

If I put a breakpoint, it seems that the call to messageFunc is returning undefined but a Promise is assumed (it’s taking the error path):

Screenshot 2022-02-07 at 12 39 29

(why showMessage is being called here with an error is another issue I need to investigate, but this feels like an issue on its own).

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
dbaeumercommented, Feb 7, 2022

Let me know what the outcome is. The messageFunc should point to existing VS Code API.

0reactions
DanTupcommented, Feb 7, 2022

Actually, this has always been this way - but before it was just an Information message and the test missed it. Most of the errors handled by this are actually prevented earlier by validation before we send the request, so I’ll just amend the test to handle it. There is no regression here (only a change in the severity of the error message shown by the LSP client).

(Sorry for another misfire 😬)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'then' of undefined · Issue #49400 - GitHub
Issue Id: 05d7571c-75cf-7c3f-1c01-05ad709135ca. Versions - 1.23.0 - b8475d1. Stack TypeError: Cannot read property 'then' of undefined
Read more >
Resolving the JavaScript Promise Error "TypeError: Cannot ...
TypeError : Cannot read property 'then' of undefined. In this guide, we will cover two code examples containing a bugs that cause this ......
Read more >
TypeError: Cannot read property 'then' of undefined
It is probably that your islogged method not returning a value in some case. After that I see that you are NOT using...
Read more >
[webpack-cli] typeerror: cannot read properties of undefined ...
I am new to Vue js and faced with the following problem: When trying to launch a project, an error occurs: Cannot read...
Read more >
Visual Studio Code Frequently Asked Questions
Visual Studio Code FAQ. Our docs contain a Common questions section as needed for specific topics. We've captured items here that don't fit...
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