question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The child process does not spawn successfully Error: spawn mongodump ENOENT

See original GitHub issue

Description

Hi.

I have a GitHub Action set up to backup a database. This GitHub Action has been running for months without incident, but now it has stopped working. After a bit of research I have found the problem. runs-on: ubuntu-latest was using Ubuntu 20.04 until last week but now use Ubuntu 22. This change causes the GitHub Action to fail (I tested this by modifying my code to use the previous Ubuntu version).

Working Action: Funcionando

Non Working Action: Sin Funcionar

Error with Ubuntu 22: ERROR

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • macOS 10.15
  • macOS 11
  • macOS 12
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

20221119.2

Is it regression?

20221027.1

Expected behavior

I expect that the GitHub Action should not fail or at least find a “migration guide” to adapt my code to the latest image of Ubuntu.

Actual behavior

The GitHub Action fail.

Repro steps

Execute the GitHub Action.

This is my code (just relevant parts)

name: Create a backup of the database

on:
  workflow_dispatch:
  schedule:
    - cron: '35 4 2-27/6 * *'
    - cron: '17 6 1 * *'

jobs:
  getBackup:
    runs-on: ubuntu-latest
    env:
      MONGO_URI: ${{ secrets.MONGO_URI }}
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-node@v3
      with:
        node-version: '16'
    - run: npm install
    - run: npm run get_backup

	const timeout = 2 * 60 * 1000; // Two minutes
	const date = getDate();

	const backupChildProcess = spawn('mongodump', [
		`--uri=${databaseURI}`,
		`--archive=./backups/${date}.gz`,
		'--gzip'], { timeout: timeout });

	backupChildProcess.on('exit', (code, signal) => {
		if (code || signal) {
			logger.error(`child process exited with code ${code} and signal ${signal}`);
			core.setFailed(`child process exited with code ${code} and signal ${signal}`);
			return;
		}

		logger.info('The database has been successfully backed up');
		core.notice(`The database has been successfully backed up. Created file: ./backups/${date}.gz`);
	});

	backupChildProcess.on('error', (err) => {
		logger.error('The child process does not spawn successfully', err);
		core.setFailed('The child process does not spawn successfully');
	});

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
dsamecommented, Nov 29, 2022

@didaquis, you have to this step to your pipeline in order to have it running on 22.04

      - run: |
          sudo wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
          sudo echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
          sudo apt-get update
          sudo apt-get install -y mongodb-org
          mongodump --version

According to MongoDB docs mongodb is not supported on Ubuntu-22.04 but the snippet above is still able to install mongo cli tools from the official mongo repo

@mikhailkoliada i’ll reassign this ticket to you to handle the further modification of the runner image

1reaction
dsamecommented, Nov 29, 2022

Hello @didaquis, we confirmed the problem is with the ubuntu-22.04 image itself - it does not contain mongodb cli for some reason. Give us, please, a little more time to suggest the workaround.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I debug "Error: spawn ENOENT" on node.js?
NOTE: This error is almost always caused because the command does not exist, because the working directory does not exist, or from a...
Read more >
[Solved-5 Solutions] Error spawn enoent on node.js - Wikitechy
Spawn may emit the ENOENT error if the filename command (i.e, 'some-command') does not exist in at least one of the directories defined...
Read more >
spawn node ENOENT" when using child_process in Node.js
How to fix "Error: spawn node ENOENT" when using child_process in Node. ... an environment variable on the child process, the error appears:....
Read more >
Installing @Forge/cli is bringing spawn ts-node ENOENT error
I'm on a Mac so I went through those steps: Installing Forge on macOS successfully. When I install forge Globally: npm install -g...
Read more >
Error spawn ENOENT on node js | Edureka Community
Before anyone spends to much time debugging this problem, most of the time it can be resolved by deleting node_modules and reinstalling the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found