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

'No inspectable targets' error in npm-test (GitHub CI) #4337

Closed
p2edwards opened this issue Mar 13, 2023 · 1 comment
Closed

'No inspectable targets' error in npm-test (GitHub CI) #4337

p2edwards opened this issue Mar 13, 2023 · 1 comment
Assignees
Labels
bug Things broken and not working as expected

Comments

@p2edwards
Copy link
Contributor

p2edwards commented Mar 13, 2023

Description

🐛 In CI, the npm-test workflow might hang up to 6 hours or until manually cancelled, instead of running the tests and succeeding/failing based on that.

Steps to Reproduce

  1. On an open PR, push a git commit where npm install, npm run build and ideally npm run test succeed when run locally.
  2. Wait 3-5 minutes for the npm-test flow to get to the npm run test stage.
  3. Cross your fingers. You might see the intermittent error, or you might see the expected behavior.

Expected behavior

The CI action for npm run test succeeds if the tests pass, and fails if they don't.

Actual behavior

Too often, the CI action for npm run test hangs with the error 'No inspectable targets', and then waits up to 360 minutes before terminating itself.

Promise Rejection:  Error: No inspectable targets
    at defaultTarget (/home/runner/work/kpi/kpi/node_modules/chrome-remote-interface/lib/chrome.js:48:23)
    at Chrome._fetchDebuggerURL (/home/runner/work/kpi/kpi/node_modules/chrome-remote-interface/lib/chrome.js:192:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Chrome._start (/home/runner/work/kpi/kpi/node_modules/chrome-remote-interface/lib/chrome.js:139:25)

Additional details

This appears to be a fairly common experience when using Chrome's remote interface.

I haven't seen it fail yet, so if #4323 gets merged and we don't see this problem again for a while, we can probably close this issue.

If that second fix doesn't work:

  • We may need to write some standalone JavaScript instead of using CLI arguments. Some of the repos that came up in my searches earlier, particularly the more "infrastructural" ones, went this way.
  • 'mocha-chrome' hasn't had an update for a while. It may be that its direct dependencies has a good answer for this already.
@p2edwards p2edwards mentioned this issue Mar 13, 2023
12 tasks
p2edwards added a commit that referenced this issue Mar 13, 2023
…skip redundant copy-fonts, use faster frontend build in pytest.

npm-test:

- Skip redundant copy-fonts, because it already runs with `npm install`
  as a postinstall script. In keeping with #4267.
- Add a timeout for mocha-chrome connection, in case it hits #4337
- Add names for steps, for improved visibility/granularity on GitHub
- Add a separate TypeScript check from build step, for visibility
- Add ESLint step on CI

pytest:

- Skip redundant copy-fonts, and skip TypeScript check when building
  prod just for running pytest. Makes pytest checks more orthogonal
  to frontend checks.
p2edwards added a commit that referenced this issue Mar 13, 2023
…skip redundant copy-fonts, use faster frontend build in pytest.

npm-test:

- Skip redundant copy-fonts, because it already runs with `npm install`
  as a postinstall script. In keeping with #4267.
- Add a timeout for mocha-chrome connection, in case it hits #4337
- Add names for steps, for improved visibility/granularity on GitHub
- Add a separate TypeScript check from build step, for visibility
- Add ESLint step on CI

pytest:

- Skip redundant copy-fonts, and skip TypeScript check when building
  prod just for running pytest. Makes pytest checks more orthogonal
  to frontend checks.
@p2edwards p2edwards self-assigned this Mar 14, 2023
@p2edwards p2edwards added the bug Things broken and not working as expected label Mar 14, 2023
@p2edwards p2edwards changed the title 'No inspectable targets' error in npm-test (GitHub CI) 'No inspectable targets' error in npm-test (GitHub CI) Mar 14, 2023
@p2edwards
Copy link
Contributor Author

This appears to be resolved since 9a8e1874.

The fix: adding --chrome-launcher.connectionPollInterval=5000 to our CI script.

      - name: Run Tests, with mocha-chrome
        run: npx mocha-chrome test/tests.html --chrome-launcher.connectionPollInterval=5000
        timeout-minutes: 1 # early timeout in case of https://github.com/kobotoolbox/kpi/issues/4337

Re-open this issue if the tests timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things broken and not working as expected
Projects
None yet
Development

No branches or pull requests

1 participant