withastro/astro

transport was disconnected, cannot call "fetchModule"

Opened this issue · 2 comments

Astro Info

Astro                    v5.0.1
Node                     v18.20.3
System                   Linux (x64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             @astrojs/mdx
                         @astrojs/sitemap

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Modifying tsconfig.json while the dev server is running throws a "transport was disconnected, cannot call "fetchModule"" exception

Steps:

  1. create a project from the blog temple
  2. start the dev server
  3. open one of the blog posts
  4. modify the tsconfig.json
  5. look at the console

What's the expected result?

No exception should be thrown

Link to Minimal Reproducible Example

https://stackblitz.com/github/withastro/astro/tree/latest/examples/blog?file=tsconfig.json

Participation

  • I am willing to submit a pull request for this issue.
bluwy commented

I can't seem to reproduce this, but it looks like a race condition happening. Can you share a stacktrace of the error?

This is the stacktrace when running with --verbose:

2024-12-05T10:25:44.724Z astro:vite Error when evaluating SSR module /home/projects/owainyqygb.github/src/content.config.ts:
|- Error: transport was disconnected, cannot call "fetchModule"
    at reviveInvokeError (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:562:17)
    at Object.invoke (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:649:15)
    at async SSRCompatModuleRunner.getModuleInformation (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:1221:73)
    at async request (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:1243:88)
    at async eval (/home/projects/owainyqygb.github/src/content.config.ts:3:44)
    at async ESModulesEvaluator.runInlinedModule (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:1074:5)
    at async SSRCompatModuleRunner.directRequest (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:1300:61)
    at async SSRCompatModuleRunner.directRequest (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:30673:23)
    at async SSRCompatModuleRunner.cachedRequest (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:1195:76)
    at async SSRCompatModuleRunner.import (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:1132:12)

2024-12-05T10:25:44.728Z astro:vite Error when evaluating SSR module file:///home/projects/owainyqygb.github/node_modules/@astrojs/mdx/dist/server.js:
|- Error: transport was disconnected, cannot call "fetchModule"
    at reviveInvokeError (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:562:17)
    at Object.invoke (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:649:15)
    at async SSRCompatModuleRunner.getModuleInformation (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:1221:73)
    at async request (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:1243:88)
    at async eval (/home/projects/owainyqygb.github/node_modules/astro/dist/core/errors/printer.js:3:44)
    at async ESModulesEvaluator.runInlinedModule (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:1074:5)
    at async SSRCompatModuleRunner.directRequest (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:1300:61)
    at async SSRCompatModuleRunner.directRequest (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:30673:23)
    at async SSRCompatModuleRunner.cachedRequest (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:1195:76)
    at async eval (/home/projects/owainyqygb.github/node_modules/astro/dist/core/errors/errors.js:3:44)

11:25:44 [ERROR] transport was disconnected, cannot call "fetchModule"
  Location:
    /home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:562:17
  Stack trace:
    at reviveInvokeError (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:562:17)
    at async SSRCompatModuleRunner.getModuleInformation (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:1221:73)
    at async eval (/home/projects/owainyqygb.github/node_modules/astro/dist/core/errors/printer.js:3:44)
    at async SSRCompatModuleRunner.directRequest (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:1300:61)
    at async SSRCompatModuleRunner.cachedRequest (file:///home/projects/owainyqygb.github/node_modules/vite/dist/node/module-runner.js:1195:76)
    ```