Skip to content

Typescript crashes in VS Code insiders latest build with all extensions disabled and TypeScript Nightly extension #52353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bennyk8y opened this issue Jan 22, 2023 · 14 comments
Assignees
Labels
Needs More Info The issue still hasn't been fully clarified Rescheduled This issue was previously scheduled to an earlier milestone

Comments

@bennyk8y
Copy link

Hi, in our company we are working in relatively big TS monorepo.
For all our developers TS crashes few times a day.
My setup:

  1. Visual Studio Code - Insiders - 1.75.0
  2. JavaScript and TypeScript Nightly extension - latest
  3. All extensions are disabled.

Another thing that we've tried is excluding from File Watcher node_modules/** and node_modules but i see its still being watched under, but i guess its a different thing.

Bug Report

🔎 Search Terms

typescript crash, typescript plugin loading infinitely

🕗 Version & Regression Information

Version: 1.75.0-insider
Commit: 243854703b7fa371abb752ec0df7817a615a308b
Date: 2023-01-13T08:04:47.712Z (1 wk ago)
Electron: 19.1.9
Chromium: 102.0.5005.194
Node.js: 16.14.2
V8: 10.2.154.23-electron.0
OS: Darwin arm64 21.3.0
Sandboxed: Yes 

The indications for this crash are

  1. Typescript icon loading infinitely
  2. Hovering on any code have a ("loading...") indication
  3. All Typescript features aren't working
@bennyk8y
Copy link
Author

setting this in tsconfig.json

"exclude": ["**/node_modules", "node_modules"]

in every package in the monorepo should help?

@DanielRosenwasser
Copy link
Member

Would you be able to provide us with a TSServer log from VS Code?

To do this, you'd need to:

  1. Open up your command palette and either
    • open your global settings by entering Preferences: Open User Settings
    • open your local project by entering Preferences: Open Workspace Settings
  2. Set the option "typescript.tsserver.log": "verbose",
  3. Restart VS Code and reproduce the problem
  4. In VS Code, run the TypeScript: Open TS Server log command
  5. This should open the tsserver.log file.

⚠ Warning: A TSServer log may include information from your workspace, including file paths and source code. If you have any concerns about posting this publicly on GitHub, let us know and you can share the details privately.

@DanielRosenwasser DanielRosenwasser added the Needs More Info The issue still hasn't been fully clarified label Jan 22, 2023
@bennyk8y
Copy link
Author

bennyk8y commented Jan 23, 2023

@DanielRosenwasser Hi!
I have it.
Can i share it privately?

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Jan 23, 2023

Sure, email Myfirstname dot Mylastname at microsoft dot com

(capitalization unfortunately matters)

@DanielRosenwasser
Copy link
Member

Just to clarify, this is more of a suspiciously long-running thing/a startup hang - it's not causing an actual crash, right?

@bennyk8y
Copy link
Author

bennyk8y commented Jan 24, 2023

Yes, VSCode itself is not crashing, just TS features stop working after this happens, sometimes an error message pops with the message

The JS/TS language service crashed

@bennyk8y
Copy link
Author

Just to clarify, all our development team that works on that repo (the main monorepo of the company) suffers from it, TS crashes few times a day.
Really not sure how can help VSCode understand not to watch node_modules, which i suspect affects the performance and maybe this somehow related to TS crashes.
But maybe the issue is not related to FileWatcher...

@bennyk8y
Copy link
Author

@DanielRosenwasser did you get the email?

@RyanCavanaugh RyanCavanaugh added the Rescheduled This issue was previously scheduled to an earlier milestone label Mar 4, 2024
@sheetalkamat
Copy link
Member

@bennyk8y can you please try with latest vscode and nightly and see if this still repros and if yes please share the verbose log and way to repro this to investigate this. Thanks

@tomitrescak
Copy link

Hi, I am using the latest VSCODE and typescript constantyl crashes in my monorepo. It works flawlesly with other non monorepo projects.

I followed your instructions, but the TS Log even after few minutes is huge. I scanned it and this is the error that keep repeating:

Err 15216 [14:58:30.541] Exception on executing command delayed processing of request 1542:

    Cannot read properties of undefined (reading 'updateFromProject')

    TypeError: Cannot read properties of undefined (reading 'updateFromProject')
        at synchronizeHostData (/Users/30031005/Github/skillpies/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:148905:14)
        at Object.getProgram (/Users/30031005/Github/skillpies/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:149084:5)
        at getSource (/Users/30031005/Github/skillpies/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]_czrxpi2kri5ztqn2ft65hk2xum/node_modules/next/dist/server/typescript/utils.js:98:69)
        at proxy.getSemanticDiagnostics (/Users/30031005/Github/skillpies/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]_czrxpi2kri5ztqn2ft65hk2xum/node_modules/next/dist/server/typescript/index.js:103:49)
        at TemplateLanguageServiceProxy.adaptDiagnosticsCall (/Users/30031005/.vscode/extensions/styled-components.vscode-styled-components-1.7.8/node_modules/typescript-template-language-service-decorator/lib/template-language-service-decorator.js:288:33)
        at Proxy.<anonymous> (/Users/30031005/.vscode/extensions/styled-components.vscode-styled-components-1.7.8/node_modules/typescript-template-language-service-decorator/lib/template-language-service-decorator.js:54:25)
        at IpcIOSession.semanticCheck (/Users/30031005/Github/skillpies/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:189731:125)
        at /Users/30031005/Github/skillpies/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:189792:14
        at MultistepOperation.executeAction (/Users/30031005/Github/skillpies/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:188448:9)
        at /Users/30031005/Github/skillpies/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:188421:71
        at IpcIOSession.executeWithRequestId (/Users/30031005/Github/skillpies/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:191498:14)
        at Object.executeWithRequestId (/Users/30031005/Github/skillpies/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:189477:57)
        at Immediate._onImmediate (/Users/30031005/Github/skillpies/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:188421:28)
        at process.processImmediate (node:internal/timers:480:21)

I can give you priveate access to my repo if needed. I would love to see where the error might originate ?

@sheetalkamat
Copy link
Member

it seems like some plugin you have thats not handling things correctly as i dont see why you should run into this as its guarded correctly.

if (host.updateFromProject && !host.updateFromProjectInProgress) {

@baptisteArno
Copy link

baptisteArno commented Oct 2, 2024

Getting this same error:

Err 11766 [10:56:57.937] Exception on executing command {
  "seq": 8722,
  "type": "request",
  "command": "definitionAndBoundSpan",
  "arguments": {
    "file": "/Users/baptistearno/Dev/typebot.io/apps/builder/src/features/blocks/logic/webhook/components/WebhookSettings.tsx",
    "line": 93,
    "offset": 43
  }
}:

    Cannot read properties of undefined (reading 'updateFromProject')

    TypeError: Cannot read properties of undefined (reading 'updateFromProject')
        at synchronizeHostData (/Users/baptistearno/Dev/typebot.io/node_modules/typescript/lib/typescript.js:149767:14)
        at Object.getProgram (/Users/baptistearno/Dev/typebot.io/node_modules/typescript/lib/typescript.js:149951:5)
        at getSource (/Users/baptistearno/Dev/typebot.io/node_modules/next/dist/server/typescript/utils.js:98:69)
        at getEntryInfo (/Users/baptistearno/Dev/typebot.io/node_modules/next/dist/server/typescript/utils.js:137:20)
        at proxy.getDefinitionAndBoundSpan (/Users/baptistearno/Dev/typebot.io/node_modules/next/dist/server/typescript/index.js:190:55)
        at IpcIOSession.getDefinitionAndBoundSpan (/Users/baptistearno/Dev/typebot.io/node_modules/typescript/lib/typescript.js:191122:73)
        at definitionAndBoundSpan (/Users/baptistearno/Dev/typebot.io/node_modules/typescript/lib/typescript.js:190048:43)
        at /Users/baptistearno/Dev/typebot.io/node_modules/typescript/lib/typescript.js:192655:15
        at IpcIOSession.executeWithRequestId (/Users/baptistearno/Dev/typebot.io/node_modules/typescript/lib/typescript.js:192644:14)
        at IpcIOSession.executeCommand (/Users/baptistearno/Dev/typebot.io/node_modules/typescript/lib/typescript.js:192653:29)
        at IpcIOSession.onMessage (/Users/baptistearno/Dev/typebot.io/node_modules/typescript/lib/typescript.js:192701:68)
        at process.<anonymous> (/Users/baptistearno/Dev/typebot.io/node_modules/typescript/lib/tsserver.js:525:14)
        at process.emit (node:events:519:28)
        at emit (node:internal/child_process:951:14)
        at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

Typescript v5.6.2
Using Zed editor with vtsls LSP which ultimately use tsserver.

The file content where it fails:

import { CopyButton } from "@/components/CopyButton";
import { TableList, type TableListItemProps } from "@/components/TableList";
import { TextLink } from "@/components/TextLink";
import { CodeEditor } from "@/components/inputs/CodeEditor";
import { useUser } from "@/features/account/hooks/useUser";
import { DataVariableInputs } from "@/features/blocks/integrations/httpRequest/components/ResponseMappingInputs";
import { getDeepKeys } from "@/features/blocks/integrations/httpRequest/helpers/getDeepKeys";
import { useTypebot } from "@/features/editor/providers/TypebotProvider";
import {
  Accordion,
  AccordionButton,
  AccordionIcon,
  AccordionItem,
  AccordionPanel,
  Button,
  FormControl,
  FormHelperText,
  Input,
  InputGroup,
  InputRightElement,
  Stack,
  Tab,
  TabList,
  TabPanel,
  TabPanels,
  Tabs,
  Text,
} from "@chakra-ui/react";
import type { ResponseVariableMapping } from "@typebot.io/blocks-integrations/httpRequest/schema";
import type { WebhookBlock } from "@typebot.io/blocks-logic/webhook/schema";
import { env } from "@typebot.io/env";
import usePartySocket from "partysocket/react";
import { useMemo, useState } from "react";

type Props = {
  blockId: string;
  options: WebhookBlock["options"];
  onOptionsChange: (options: WebhookBlock["options"]) => void;
};

export const WebhookSettings = ({
  blockId,
  options,
  onOptionsChange,
}: Props) => {
  const { typebot } = useTypebot();
  const { user } = useUser();
  const [receivedData, setReceivedData] = useState<string>();
  const [websocketStatus, setWebsocketStatus] = useState<"closed" | "opened">(
    "closed",
  );
  const [responseKeys, setResponseKeys] = useState<string[]>([]);

  const updateResponseVariableMapping = (
    responseVariableMapping: ResponseVariableMapping[],
  ) => onOptionsChange({ ...options, responseVariableMapping });

  const ws = usePartySocket({
    host: env.NEXT_PUBLIC_PARTYKIT_HOST,
    room: `${user?.id}/${typebot?.id}/webhooks`,

    onMessage(e) {
      setReceivedData(e.data);
      setResponseKeys(getDeepKeys(JSON.parse(e.data)));
      setWebsocketStatus("closed");
      ws.close();
    },
    onError(e) {
      console.log("error", e);
    },
    startClosed: true,
  });

  const listenForTestEvent = () => {
    ws.reconnect();
    setWebsocketStatus("opened");
  };

  const ResponseMappingInputs = useMemo(
    () =>
      function Component(props: TableListItemProps<ResponseVariableMapping>) {
        return <DataVariableInputs {...props} dataItems={responseKeys} />;
      },
    [responseKeys],
  );

  const urlBase = typebot
    ? `${env.NEXT_PUBLIC_VIEWER_URL[0]}/api/v1/typebots/${typebot.id}/blocks/${blockId}/executeWebhook`
    : "";

  return (
    <Stack>
      <Tabs size="sm" isFitted variant="">
        <TabList>
          <Tab>Test URL</Tab>
          <Tab>Production URL</Tab>
        </TabList>

        <TabPanels>
          <TabPanel>
            {typebot && (
              <FormControl as={Stack}>
                <InputGroup size="sm">
                  <Input type={"text"} defaultValue={urlBase} />
                  <InputRightElement width="60px">
                    <CopyButton size="sm" textToCopy={urlBase} />
                  </InputRightElement>
                </InputGroup>
              </FormControl>
            )}
          </TabPanel>
          <TabPanel>
            {typebot && (
              <FormControl as={Stack}>
                <InputGroup size="sm">
                  <Input
                    type={"text"}
                    defaultValue={`${urlBase}/<result_id>`}
                  />
                  <InputRightElement width="60px">
                    <CopyButton
                      size="sm"
                      textToCopy={`${urlBase}/<result_id>`}
                    />
                  </InputRightElement>
                </InputGroup>
                <FormHelperText mt="0">
                  You can easily get the Result ID{" "}
                  <TextLink
                    isExternal
                    href="https://docs.typebot.io/editor/blocks/logic/set-variable#result-id"
                  >
                    with a Set variable block
                  </TextLink>
                  .
                </FormHelperText>
              </FormControl>
            )}
          </TabPanel>
        </TabPanels>
      </Tabs>

      <Button
        onClick={listenForTestEvent}
        colorScheme="blue"
        isLoading={websocketStatus === "opened"}
      >
        Listen for test event
      </Button>
      {websocketStatus === "opened" && (
        <Stack borderWidth="1px" p="4" borderRadius="md" spacing="3">
          <Text fontSize="sm">
            Waiting for an{" "}
            <TextLink
              href={"https://docs.typebot.io/api-reference/authentication"}
              isExternal
            >
              authenticated
            </TextLink>
            POST request to the Test URL...
          </Text>
        </Stack>
      )}
      {receivedData && (
        <CodeEditor isReadOnly lang="json" value={receivedData} />
      )}
      {(receivedData ||
        (options?.responseVariableMapping &&
          options.responseVariableMapping.length > 0)) && (
        <Accordion allowMultiple>
          <AccordionItem>
            <AccordionButton justifyContent="space-between">
              Save in variables
              <AccordionIcon />
            </AccordionButton>
            <AccordionPanel pt="4">
              <TableList<ResponseVariableMapping>
                initialItems={options?.responseVariableMapping}
                onItemsChange={updateResponseVariableMapping}
                addLabel="Add an entry"
              >
                {(props) => <ResponseMappingInputs {...props} />}
              </TableList>
            </AccordionPanel>
          </AccordionItem>
        </Accordion>
      )}
    </Stack>
  );
};

This happens when I try to trigger the autocomplete drodown on in variant="". It didn't display anything so I checked the logs and saw that error

@kekswar
Copy link

kekswar commented Dec 20, 2024

Hi! Have the same problem.
Work in monorepo and typescript constantyl crashes in my monorepo
Very annoying and I seem to have tried everything but can't seem to solve this problem. Only restarting ts server helps :(

 Err 78525 [23:48:06.354] Exception on executing command delayed processing of request 1216:

    Cannot read properties of undefined (reading 'updateFromProject')

    TypeError: Cannot read properties of undefined (reading 'updateFromProject')
        at synchronizeHostData (/Users/kekswar/frontend/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:151370:14)
        at Object.getProgram (/Users/kekswar/frontend/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:151555:5)
        at getSource (/Users/kekswar/frontend/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]_react-dom@19._e4gvlxth7dn5lhvsn23imq3fai/node_modules/next/dist/server/typescript/utils.js:98:69)
        at proxy.getSemanticDiagnostics (/Users/kekswar/frontend/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]_react-dom@19._e4gvlxth7dn5lhvsn23imq3fai/node_modules/next/dist/server/typescript/index.js:103:49)
        at IpcIOSession.semanticCheck (/Users/kekswar/frontend/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:193371:125)
        at doSemanticCheck (/Users/kekswar/frontend/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:193444:12)
        at /Users/kekswar/frontend/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:193492:49
        at MultistepOperation.executeAction (/Users/kekswar/frontend/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:192055:9)
        at /Users/kekswar/frontend/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:192028:71
        at IpcIOSession.executeWithRequestId (/Users/kekswar/frontend/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:195207:14)
        at Object.executeWithRequestId (/Users/kekswar/frontend/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:193102:74)
        at Immediate._onImmediate (/Users/kekswar/frontend/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:192028:28)
        at process.processImmediate (node:internal/timers:485:21)

@lucastnr
Copy link

lucastnr commented Apr 15, 2025

@bennyk8y did you get a fix on that? I'm still facing this on Zed Editor with typescript 5.8.2 in a monorepo with nx 19.8.4.

I often have to restart the Typescript server for it to get back on

2025-04-15T12:40:36.826163-03:00 [WARN] Get definition via vtsls failed: Request textDocument/definition failed with message: <semantic> TypeScript Server Error (5.8.2)
Cannot read properties of undefined (reading 'updateFromProject')
TypeError: Cannot read properties of undefined (reading 'updateFromProject')
    at synchronizeHostData (/Users/lucas/dev/skip-valhalla/node_modules/typescript/lib/typescript.js:152023:14)
    at Object.getProgram (/Users/lucas/dev/skip-valhalla/node_modules/typescript/lib/typescript.js:152208:5)
    at getSource (/Users/lucas/dev/skip-valhalla/node_modules/next/dist/server/typescript/utils.js:98:69)
    at getEntryInfo (/Users/lucas/dev/skip-valhalla/node_modules/next/dist/server/typescript/utils.js:137:20)
    at proxy.getDefinitionAndBoundSpan (/Users/lucas/dev/skip-valhalla/node_modules/next/dist/server/typescript/index.js:190:55)
    at IpcIOSession.getDefinitionAndBoundSpan (/Users/lucas/dev/skip-valhalla/node_modules/typescript/lib/typescript.js:194421:73)
    at definitionAndBoundSpan (/Users/lucas/dev/skip-valhalla/node_modules/typescript/lib/typescript.js:193341:43)
    at /Users/lucas/dev/skip-valhalla/node_modules/typescript/lib/typescript.js:195998:15
    at IpcIOSession.executeWithRequestId (/Users/lucas/dev/skip-valhalla/node_modules/typescript/lib/typescript.js:195987:14)
    at IpcIOSession.executeCommand (/Users/lucas/dev/skip-valhalla/node_modules/typescript/lib/typescript.js:195996:29)
    at IpcIOSession.onMessage (/Users/lucas/dev/skip-valhalla/node_modules/typescript/lib/typescript.js:196044:68)
    at process.<anonymous> (/Users/lucas/dev/skip-valhalla/node_modules/typescript/lib/_tsserver.js:546:14)
    at process.emit (node:events:519:28)
    at emit (node:internal/child_process:951:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs More Info The issue still hasn't been fully clarified Rescheduled This issue was previously scheduled to an earlier milestone
Projects
None yet
Development

No branches or pull requests

8 participants