Skip to content
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

transport was disconnected, cannot call "fetchModule" #12611

Open
1 task done
mandar1jn opened this issue Dec 3, 2024 · 3 comments
Open
1 task done

transport was disconnected, cannot call "fetchModule" #12611

mandar1jn opened this issue Dec 3, 2024 · 3 comments
Labels
needs triage Issue needs to be triaged

Comments

@mandar1jn
Copy link
Contributor

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.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Dec 3, 2024
@bluwy
Copy link
Member

bluwy commented Dec 4, 2024

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

@mandar1jn
Copy link
Contributor Author

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)
    ```

@vnphanquang
Copy link

Might not be helpful at all, but I got the same issue today when introducing a custom Vite plugin to a SvelteKit project (no Astro specifics). Problem seems to be plugin A is generating some modules that were being imported by plugin B. I also noticed that HMR is broken when this error is observed. In my case shifting plugin order, using different hook, and playing around with enforce solved the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

3 participants