The child process does not spawn successfully Error: spawn mongodump ENOENT
See original GitHub issueDescription
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:
Non Working Action:
Error with Ubuntu 22:
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:
- Created 10 months ago
- Comments:8 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@didaquis, you have to this step to your pipeline in order to have it running on 22.04
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
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.