Gulp: Deprecation warning since Node `14.5.0`

Created on 2 Jul 2020  ยท  5Comments  ยท  Source: gulpjs/gulp

Before you open this issue, please complete the following tasks:

  • [x] use the search bar at the top of the page to search this repository for similar issues or discussions that have already been opened.
  • [x] if you are looking for help from the gulp team or community, open a discussion.
  • [x] if you think there is a problem with the plugin you're using, open a discussion.
  • [x] if you think there is a bug in our code, open this issue.

What were you expecting to happen?

No deprecation warning should be printed on the console since Node 14.5.0.

What actually happened?

A deprecation warning is printed on the console since Node 14.5.0.

(node:47881) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead.

Please give us a sample of your gulpfile

const gulp = require('gulp')

module.exports.example = function () {
  return gulp.src([__filename])
}
$ gulp example
[01:17:58] Using gulpfile ~/Desktop/gulpfile.js
[01:17:58] Starting 'example'...
(node:47881) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[01:17:58] Finished 'example' after 14 ms

Please provide the following information:

  • OS & version: Ubuntu 20.04
  • node version: v14.5.0
  • npm version: v6.14.5
  • gulp version: CLI version: 2.3.0, Local version: 4.0.2

Most helpful comment

Looks like warning was the result of https://github.com/nodejs/node/pull/33801, but showing the warning was unintentional and was addressed by https://github.com/nodejs/node/pull/34245 (which was merged, despite the GitHub status shown). Hopefully that fix will show up in the next released node version.

All 5 comments

I don't know if that can be of any help, but this is the full stacktrace:

(node:4478) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead.
    at emitMakeCallbackDeprecation (domain.js:123:13)
    at FSReqCallback.topLevelDomainCallback (domain.js:134:5)
    at FSReqCallback.callbackTrampoline (internal/async_hooks.js:121:14)

I managed to silence the warning by adding this code at the top of my gulpfile.js, before the first require.

{
    const { emitWarning } = process;
    process.emitWarning =
    (warning, type, code, ...extraArgs) =>
    code !== 'DEP0097' && emitWarning(warning, type, code, ...extraArgs);
}
The root of the problem is that gulp uses the [domain](https://nodejs.org/docs/latest/api/domain.html) module in one of its transitive dependencies ([async-done](https://www.npmjs.com/package/async-done)).
โ””โ”€โ”ฌ [email protected]
  โ”œโ”€โ”ฌ [email protected]
  โ”‚ โ””โ”€โ”€ [email protected] 
  โ””โ”€โ”ฌ [email protected]
    โ””โ”€โ”ฌ [email protected]
      โ”œโ”€โ”€ [email protected]  deduped
      โ””โ”€โ”ฌ [email protected]
        โ””โ”€โ”€ [email protected]  deduped

The domain module has been pending deprecation for years, but no equally usable alternative exists yet, which is a shame. Not sure why Node.js started to emit the warning in version 14.5.0 though. At least I couldn't spot a mention of it in the release notes.

Looks like warning was the result of https://github.com/nodejs/node/pull/33801, but showing the warning was unintentional and was addressed by https://github.com/nodejs/node/pull/34245 (which was merged, despite the GitHub status shown). Hopefully that fix will show up in the next released node version.

The deprecation warning is no longer shown in Node 14.6.0.

@AlexanderOMara thanks for the update! And huge thanks to @noahbrenner and everyone else that helped track the upstream problems!

I'm going to close this out now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aaronroberson picture aaronroberson  ยท  4Comments

lehni picture lehni  ยท  4Comments

emccorson picture emccorson  ยท  4Comments

ssteinerx picture ssteinerx  ยท  3Comments

yapcheahshen picture yapcheahshen  ยท  5Comments