-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Error: [birpc] timeout on calling "fetch" #5182
Comments
This is happening for 2/20 nx projects I have. |
If you want a quick fix, and your setup allows it, you can try #4106 (comment), This worked for us. |
I'm getting timeout on high-end PC, not in CI/CD: I've tried to increase timeout as suggested, but it doesn't help. 3/20 projects just hang on vite with zero activity, clearly not a performance issue, they aren't even trying to run as far as I can tell |
Hello @Maxim-Mazurok. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
I'm also facing this error while running tests in a nx wprkspace with vite@5.1.1 but working fine with vite@5.0.12 |
same error here with vite 5.1.1 |
Some more reproduction help: It doesn't repro when I only have 1 test/spec file in the project. If I have 2 test/spec files (even if they are empty) - I get a stable reproduction. I am running an individual project ( Here's my import { defineConfig } from "vite";
import { merge } from "ts-deepmerge";
import viteTsConfigPaths from "vite-tsconfig-paths";
// eslint-disable-next-line @nx/enforce-module-boundaries
import { myDefaultUserConfig } from "../../vite-stuff";
export default defineConfig(
merge(myDefaultUserConfig, {
cacheDir: "../../node_modules/.vite/math",
plugins: [
viteTsConfigPaths({
root: "../../",
}),
],
test: {
cache: {
dir: "../../node_modules/.vitest",
},
environment: "node",
include: ["src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
},
}),
); Here's my import { fileURLToPath } from "node:url";
import viteTsConfigPaths from "vite-tsconfig-paths";
import { UserConfig } from "vitest/config";
// import { pathToResources } from "@nx/nx-utils"; // TODO: figure out how to re-arrange imports
//@ts-expect-error doesn't matter, seems to work fine
const pathToResources = new URL("resources/", import.meta.url);
interface MyUserConfig extends UserConfig {
plugins: Required<UserConfig["plugins"]>;
test: Required<
Pick<
Exclude<Required<UserConfig["test"]>, undefined>,
"globals" | "restoreMocks" | "reporters"
> & {
setupFiles: Exclude<
Pick<
Exclude<Required<UserConfig["test"]>, undefined>,
"setupFiles"
>["setupFiles"],
string
>;
}
>;
}
export const myDefaultUserConfig: MyUserConfig = {
plugins: [viteTsConfigPaths()],
test: {
globals: true,
setupFiles: [
fileURLToPath(new URL("setupFiles/toEqual.ts", pathToResources)), // requires server.fs.strict to be false to work
],
restoreMocks: false, // TODO: enable this, but beware of issues with vi.mock tho (TypeError: Class constructor GoogleSheetsDownloader cannot be invoked without 'new')
reporters: ["default"],
},
server: {
fs: {
strict: false, // this will allow to load setup file from resources
},
},
}; Hope this helps to resolve the issue, cheers! |
Same, two spec files and it breaks reliably. |
Added reproduction on a clean nx setup, see readme for steps I took to set it up: https://github.com/Maxim-Mazurok/vite-repro |
This is an issue with how Vite resolves tsconfigs: |
By the way, the workaround is to remove references from tsconfig: {
"extends": "../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
- "references": [
- {
- "path": "./tsconfig.lib.json"
- },
- {
- "path": "./tsconfig.spec.json"
- }
- ]
}
|
I'm facing the exactly same issue while using nx with vitest. I'm using newer vitest then the error message would be: which modified by #5103 Take https://github.com/Maxim-Mazurok/vite-repro as an example, the better W/A would be to modify the Details of W/A: diff --git a/bla/tsconfig.lib.json b/bla/tsconfig.lib.json
index 2fd1e3f..4d0c527 100644
--- a/bla/tsconfig.lib.json
+++ b/bla/tsconfig.lib.json
@@ -1,5 +1,5 @@
{
- "extends": "./tsconfig.json",
+ "extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "../dist/out-tsc",
"declaration": true,
diff --git a/bla/tsconfig.spec.json b/bla/tsconfig.spec.json
index 4f7fed6..3e6ed46 100644
--- a/bla/tsconfig.spec.json
+++ b/bla/tsconfig.spec.json
@@ -1,5 +1,5 @@
{
- "extends": "./tsconfig.json",
+ "extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "../dist/out-tsc",
"types": [ @Maxim-Mazurok FYI |
@daihere1993 I am running into the same problem in my Nx repo with vite 5.1.x and vitest 1.3.x. In the workaround you suggested, that is the exact structure of the |
The issue we facing is a known issue(dominikg/tsconfck#154) of tsconfck which is a dependency package of vite to parse tsconfig files.
Above is a typical structure and typescript configuration of nx app with vitest. As you can see the Thus the W/A I suggested is to avoid such "circle", and just extends |
@daihere1993 Ah, apologies, I misread the |
strange, for me only |
The fix on Vite side is released in 5.1.6 (vitejs/vite#16124). |
Describe the bug
Getting
Error: [birpc] timeout on calling "fetch"
repeatedly after upgradingReproduction
https://github.com/Maxim-Mazurok/vite-repro
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: