Unitech / Unitech/pm2

Use pm2-runtime with env passed in Dockerfile throws Using a domain property in MakeCallback is deprecated warning

Open
#4,786 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

CMD ["pm2-runtime", "process.json", "--env", "prod"], the log shows (node:66) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead.

How could we reproduce this issue?

I am using nest.js framework to develop my application. And i create a Dockerfile to run my app in the container. Below is the Dockerfile. You can see i use CMD ["pm2-runtime", "process.json", "--env", "prod"] in the Dockerfile

FROM node:10
WORKDIR /opt/code/service

ARG PROJECT=service
ADD ${PROJECT}.tgz .

RUN yarn global add pm2 \
&& yarn install --production

EXPOSE 3000
CMD ["pm2-runtime", "process.json", "--env", "prod"]
#CMD ["pm2-runtime", "process.json"] 

Docker Logs:

2020-07-21T04:46:45: PM2 log: App [service:0] starting in -fork mode-
2020-07-21T04:46:45: PM2 log: App [service:0] online
2020-07-21 04:46:51: (node:17) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead.

If i use CMD ["pm2-runtime", "process.json"] in the Dockerfile without passing env, then the DeprecationWarning is gone. Though it doesn't affect the application run, I would like to know how this could happen. Thanks

Supporting information

$ pm2 report
--- PM2 report ----------------------------------------------------------------
Date                 : Tue Jul 21 2020 04:43:47 GMT+0000 (Coordinated Universal Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 4.4.0
node version         : 10.21.0
node path            : not found
argv                 : /usr/local/bin/node,/usr/local/bin/pm2-runtime,process.json,--env,prod
argv0                : node
user                 : undefined
uid                  : 0
gid                  : 0
uptime               : 13min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 4.4.0
node version         : 10.21.0
node path            : /usr/local/bin/pm2
argv                 : /usr/local/bin/node,/usr/local/bin/pm2,report
argv0                : node
user                 : undefined
uid                  : 0
gid                  : 0
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
cpus nb              : 6
freemem              : 625934336
totalmem             : 2087469056
home                 : /root
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name       │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0   │ service    │ default     │ 0.0.1   │ fork    │ 66       │ 12m    │ 1    │ online    │ 0%       │ 113.2mb  │ root     │ disabled │
└─────┴────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------

Please copy/paste the above report in your issue on https://github.com/Unitech/pm2/issues

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Dockerfile's pm2-runtime command and compare it with the command that omits --env prod. Review the supplied PM2 report for version and Node.js details, then reproduce both commands and determine what causes the DEP0097 warning; done means the difference is explained and an appropriate PM2 change or documented limitation is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, javascript, node.js
Domain
cli, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.