yarn exit 1 results in status 'online'
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
Problem 1: the command below fails to start a successfull process (as expected), yet pm2 shows as if it is 'online'.
Problem 2: if the command succeeds and runs a nextjs server, after a linux kill command of the node process, pm2 does not restart the process (it does restart it when I kill the parent yarn process)
What works: pm2 stop ... stop the started process. Also pm2 restart ... works.
So the following command ...
pm2 start yarn --name frontend-dk --restart-delay 30000 -- prod -p 3002
... results in a build/startup error with exit code 1:
/root/.pm2/logs/frontend-dk-out.log last 15 lines:
1|frontend | yarn run v1.22.18
1|frontend | $ next build && next start -p 3002
1|frontend | info - Loaded env from /srv/frontend-dk/.env
1|frontend | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
/root/.pm2/logs/frontend-dk-error.log last 15 lines:
1|frontend | > Build error occurred
1|frontend | Error: Specified images.domains should be an Array of strings received invalid values ().
1|frontend | See more info here: https://nextjs.org/docs/messages/invalid-images-config
1|frontend | at assignDefaults (/srv/frontend-dk/node_modules/next/dist/server/config.js:289:23)
...
1|frontend | at async Object.build [as default] (/srv/frontend-dk/node_modules/next/dist/build/index.js:55:25)
1|frontend | error Command failed with exit code 1.
Why is pm2 showing status as online? No proces was even started successfully.
# pm2 ls
┌─────┬────────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼────────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 1 │ frontend-dk │ default │ 0.39.1 │ fork │ 152238 │ 78m │ 0 │ online │ 0% │ 79.1mb │ root │ disabled │
└─────┴────────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported command pm2 start yarn --name frontend-dk --restart-delay 30000 -- prod -p 3002 and inspect PM2's process-status and child-process handling. Compare the failed Yarn startup with killing the Node.js child and the parent Yarn process; done means exit code 1 is not shown as online and terminating the server child triggers a restart.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nextjs, node.js
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100