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

Error: [birpc] timeout on calling "fetch" on CI/CD environment #4106

Closed
6 tasks done
tychenjiajun opened this issue Sep 11, 2023 · 7 comments
Closed
6 tasks done

Error: [birpc] timeout on calling "fetch" on CI/CD environment #4106

tychenjiajun opened this issue Sep 11, 2023 · 7 comments

Comments

@tychenjiajun
Copy link

tychenjiajun commented Sep 11, 2023

Describe the bug

This may be caused by the dynamic import function import().

Reproduction

Modify DEFAULT_TIMEOUT to 1 in node_modules/vitest/dist/vendor-index.b271ebe4.js, and run the following test.

import { expect, test } from 'vitest';

test('should export a function', async () => {
    const { describe } = await import('vitest');
    expect(typeof describe).toBe('function');
});

You can see error:

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: [birpc] timeout on calling "fetch"
 ❯ Timeout._onTimeout node_modules/vitest/dist/vendor-index.b271ebe4.js:39:22
 ❯ listOnTimeout node:internal/timers:569:17
 ❯ process.processTimers node:internal/timers:512:7

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 Test Files  no tests
      Tests  no tests
     Errors  1 error
   Start at  15:08:34
   Duration  1.11s (transform 0ms, setup 0ms, collect 0ms, tests 0ms, environment 0ms, prepare 0ms)

System Info

  System:
    OS: macOS 13.5.2
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 23.96 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.1 - ~/.nvm/versions/node/v18.16.1/bin/node
    Yarn: 1.22.19 - ~/Library/pnpm/yarn
    npm: 9.5.1 - ~/.nvm/versions/node/v18.16.1/bin/npm
    pnpm: 8.6.12 - ~/Library/pnpm/pnpm
  Browsers:
    Brave Browser: 116.1.57.62
    Safari: 16.6
  npmPackages:
    @vitejs/plugin-react: ^4.0.4 => 4.0.4 
    @vitejs/plugin-react-swc: ^3.3.2 => 3.3.2 
    @vitest/ui: ^0.34.4 => 0.34.4 
    vite: ^4.4.9 => 4.4.9 
    vitest: ^0.34.4 => 0.34.4 

Used Package Manager

yarn

Validations

@tychenjiajun
Copy link
Author

tychenjiajun commented Sep 11, 2023

Can we add a way to pass timeout in createBirpc? We want a longer time for setTimeout in some low-end machines.

Our temporary solution: add a line in our script before running test

sed -i 's/const DEFAULT_TIMEOUT = 6e4;/const DEFAULT_TIMEOUT = 6e6;/' node_modules/vitest/dist/vendor-index.b271ebe4.js

@AriPerkkio
Copy link
Member

The default timeout there is 60 seconds. If your await import() call takes longer than a minute there is definitely something wrong.

The reproduction case here is not enough as it makes birpc throw error if call takes longer 1 millisecond.

Are you using useFakeTimers() in your real test case?

@github-actions
Copy link

Hello @tychenjiajun. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

@tychenjiajun
Copy link
Author

The default timeout there is 60 seconds. If your await import() call takes longer than a minute there is definitely something wrong.

The reproduction case here is not enough as it makes birpc throw error if call takes longer 1 millisecond.

Are you using useFakeTimers() in your real test case?

How does useFakeTimers() affect setTImeout()? Doesn't it only affect the test cases in the file it invoked? Will it affect the following test cases in the same process/thread if we don't call useRealTimers()?

@AriPerkkio
Copy link
Member

AriPerkkio commented Sep 12, 2023

It should not affect birpc at all. In earlier versions of Vitest there have been bugs where timer and Math.random mocks leaked to birpc. Those have been fixed for a while though.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 16, 2023
@gDlugokecki
Copy link

I have the same issue - while running tests in pipeline i sometimes get this error

Error: [birpc] timeout on calling "fetch"

@tychenjiajun were you able to solve this issue?

@tychenjiajun
Copy link
Author

I have the same issue - while running tests in pipeline i sometimes get this error

Error: [birpc] timeout on calling "fetch"

@tychenjiajun were you able to solve this issue?

See #4106 (comment)

@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants