Typescript: TypeError: Cannot read property 'symbol' of undefined in 'unknown' during 'completionInfo'

Created on 11 Nov 2019  路  16Comments  路  Source: microsoft/TypeScript


This issue comes from crash dumps in telemetry. We've tried to de-duplicate issues on a best-effort basis, comparing the sequence of methods called and the command requested while ignoring line numbers.
TypeScript version prefix: 3.7.2
VSCode version: 1.40.0
Command requested: completionInfo
Hitting sessions: 644
Five line hash: f05606d1109b3c208a72950074c84f78
Stack:

    at <anonymous> (tsserver.js:106112:69)
    at forEach (tsserver.js:170:30)
    at get (tsserver.js:106105:24)
    at getSymbolsFromOtherSourceFileExports (tsserver.js:107235:79)
    at getGlobalCompletions (tsserver.js:107064:49)
    at tryGetGlobalSymbols (tsserver.js:106976:25)
    at getCompletionData (tsserver.js:106774:22)
    at getCompletionsAtPosition (tsserver.js:106138:34)
    at getCompletionsAtPosition (tsserver.js:130738:35)
    at Session.getCompletions (tsserver.js:140355:64)
    at _a.<computed> (tsserver.js:139335:61)
    at <anonymous> (tsserver.js:140870:88)
    at Session.executeWithRequestId (tsserver.js:140861:28)
    at Session.executeCommand (tsserver.js:140870:33)
    at Session.onMessage (tsserver.js:140893:35)
    at <anonymous> (tsserver.js:142208:27)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
Bug Telemetry

Most helpful comment

I've just spent an hour trying to find a solution to this. Thanks @herberthobregon, indeed it was the Firebase SDK. For me the solution was even simpler. I just deleted the file empty-import.d.ts in node modules under the firebase package. Works fine for now...

All 16 comments

I've been noticing this issue for the past few months (Windows), and have tried everything short of a reformat-- reinstalling, running in WSL, running my own Typescript version. Let me know if I can provide any information to help fix this.

In my particular case it is a problem of firebase web. And its empty import...
in empty-import.d.ts

export = undefined

in this point, autocomplete of tsserver crash.

the solutions is to move the firebase into the some-package and install this package with yarn add file:./some-package

I've just spent an hour trying to find a solution to this. Thanks @herberthobregon, indeed it was the Firebase SDK. For me the solution was even simpler. I just deleted the file empty-import.d.ts in node modules under the firebase package. Works fine for now...

@Markonis The problem is when you install another dependency on your project, empty-import.d.ts will be added again. Eliminating it, I realized that this was the mistake, but to give you a permanent solution in what typescript links the solution to its main branch, you must do the above

@herberthobregon Makes total sense, thanks! 馃憣 What about just commenting that line in the file?

I was experiencing "low performance" of autocomplete in vscode for a few weeks now, but it was only with a specific project. Today I realized it might be tsserver related, I turned on logs for the first time ever and this error popped up there. Now I know why, yes, Firebase is the culprit. Thanks a lot for finding this, saves a lot of nerves :)

I wonder, has anyone reported it back to Firebase? Or what are the next steps here? Is it something that will be fixed on the TS side?

Nevermind, it seems to be already fixed, just not released yet https://github.com/firebase/firebase-js-sdk/pull/2379.

This issue reproduced in the following context:
TypeScript version prefix: 3.7.3
VSCode version: 1.41.0-insider
Command requested: completionInfo
Hitting sessions: 715
Five line hash: 6909d6521a82e0c77a1194f2718eb8c1
Stack:

TypeError: Cannot read property 'symbol' of undefined
    at unknown (tsserver.js:106146:69)
    at Object.forEach (tsserver.js:170:30)
    at Object.get (tsserver.js:106139:24)
    at getSymbolsFromOtherSourceFileExports (tsserver.js:107269:79)
    at getGlobalCompletions (tsserver.js:107098:49)
    at tryGetGlobalSymbols (tsserver.js:107010:25)
    at getCompletionData (tsserver.js:106808:22)
    at Object.getCompletionsAtPosition (tsserver.js:106172:34)
    at Proxy.getCompletionsAtPosition (tsserver.js:130772:35)
    at IOSession.Session.getCompletions (tsserver.js:140396:64)
    at Session.handlers.ts.createMapFromTemplate._a.<computed> (tsserver.js:139376:61)
    at unknown (tsserver.js:140911:88)
    at IOSession.Session.executeWithRequestId (tsserver.js:140902:28)
    at IOSession.Session.executeCommand (tsserver.js:140911:33)
    at IOSession.Session.onMessage (tsserver.js:140934:35)
    at Interface.<anonymous> (tsserver.js:142249:27)
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()

@Markonis it is exactly the same, when you reinstall another dependency it will rewrite the file. as I said before, you should wrap firebase in a local package so that it does not index typescript server.

this is the temp solution 馃槳

@yamachu just FYI the nightly does indeed solve the issue with firebase SDK.

Two things that would be helpful here:

  • vscode could surface this crash more explicitly. The way I experienced it was that I suddenly got lots of "No suggestions" for autocomplete in situations where there clearly were valid completions. I assumed it was some kind of language service timeout due to complicated types until I dug into the tsserver logs.

  • An easier way to disable bundled typings with bugs in them. I've tried adding node_modules/firebase/empty-import.d.ts to the exclude section in tsconfig.json as well as compilerOptions.paths but to no avail. For another example of where this would have been helpful, see https://github.com/alex3165/react-mapbox-gl/issues/666

This issue reproduced in the following context:
TypeScript version prefix: 3.7.4
VSCode version: 1.41.1
Command requested: completionInfo
Hitting sessions: 132
Five line hash: 6909d6521a82e0c77a1194f2718eb8c1
Stack:

TypeError: Cannot read property 'symbol' of undefined
    at unknown (tsserver.js:106154:69)
    at Object.forEach (tsserver.js:170:30)
    at Object.get (tsserver.js:106147:24)
    at getSymbolsFromOtherSourceFileExports (tsserver.js:107277:79)
    at getGlobalCompletions (tsserver.js:107106:49)
    at tryGetGlobalSymbols (tsserver.js:107018:25)
    at getCompletionData (tsserver.js:106816:22)
    at Object.getCompletionsAtPosition (tsserver.js:106180:34)
    at Object.getCompletionsAtPosition (tsserver.js:130780:35)
    at IOSession.Session.getCompletions (tsserver.js:140417:64)
    at Session.handlers.ts.createMapFromTemplate._a.<computed> (tsserver.js:139397:61)
    at unknown (tsserver.js:140932:88)
    at IOSession.Session.executeWithRequestId (tsserver.js:140923:28)
    at IOSession.Session.executeCommand (tsserver.js:140932:33)
    at IOSession.Session.onMessage (tsserver.js:140955:35)
    at Interface.<anonymous> (tsserver.js:142270:27)
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()

I have the same error in vscode when triggering intellisense at the end (EOL) of a word, the intellisense is not working anymore after the exception is throwed up

This issue reproduced in the following context:
TypeScript version prefix: 3.7.5
VSCode version: 1.41.1
Command requested: completionInfo
Hitting sessions: 322
Five line hash: 6909d6521a82e0c77a1194f2718eb8c1
Stack:

TypeError: Cannot read property 'symbol' of undefined
    at unknown (tsserver.js:106182:69)
    at Object.forEach (tsserver.js:170:30)
    at Object.get (tsserver.js:106175:24)
    at getSymbolsFromOtherSourceFileExports (tsserver.js:107305:79)
    at getGlobalCompletions (tsserver.js:107134:49)
    at tryGetGlobalSymbols (tsserver.js:107046:25)
    at getCompletionData (tsserver.js:106844:22)
    at Object.getCompletionsAtPosition (tsserver.js:106208:34)
    at Object.getCompletionsAtPosition (tsserver.js:130808:35)
    at IOSession.Session.getCompletions (tsserver.js:140445:64)
    at Session.handlers.ts.createMapFromTemplate._a.<computed> (tsserver.js:139425:61)
    at unknown (tsserver.js:140960:88)
    at IOSession.Session.executeWithRequestId (tsserver.js:140951:28)
    at IOSession.Session.executeCommand (tsserver.js:140960:33)
    at IOSession.Session.onMessage (tsserver.js:140983:35)
    at Interface.<anonymous> (tsserver.js:142298:27)
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()
    at suppressed_frame()

I think this is fixed now -- haven't seen any repros in over a month.

Revised stack format and updated hash.

Was this page helpful?
0 / 5 - 0 ratings