Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve "Using a domain property in MakeCallback is deprecated" warning when running gulp tasks?

Tags:

node.js

gulp

I'm using node with gulp to run some building tasks. This worked fine until a couple days ago. Now (I assume after an upgrade/update, not sure which specific one. I believe it's the update of node from 14.4 to 14.5) I keep getting this warning

[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)

I cannot figure out how to use --trace-deprecation with gulp so I couldn't find what is triggering it.
My actual gulpfile is much longer and commenting out sections, changing pipeline to .pipe, updating node and dependencies, using async/await, and some other minor changing didn't get me any closer to narrowing down what the issue is.

Therefore I set up this minimal working example below:

  • running the default gulp task (clean_fake) does not trigger the warning
  • both gulp clean and gulp styles cause the warning to show
const gulp = require('gulp');
const del = require('del');
const sass = require('gulp-sass');

async function clean() {
    const deletedPaths = await del([ './js/*.site.js', './style.css' ], { dryRun: true });
    console.log('Deleted files and directories:\n', deletedPaths.join('\n'));
}

async function clean_fake() {
    const deletedPaths = await test();
    console.log('Deleted files and directories:\n', deletedPaths.join('\n'));
}
function test() {
    console.log('dummy function');
    return [ 'test' ];
}

function styles() {
    return gulp.src('./src/sass/style.scss').pipe(sass()).pipe(gulp.dest('./'));
}

exports.clean = clean;
exports.styles = styles;

exports.default = clean_fake;

Current versions:
node: v14.5.0
npm: 6.14.6

del: 5.1.0
gulp: 4.0.2
gulp-sass: 4.1.0

PS: There is this similar question, but with no answer for my problem.

Update:

I figured out how to trace deprecation by running it with NODE_OPTIONS:

NODE_OPTIONS='--trace-deprecation' gulp

However the output didn't help me much

(node:146806) [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)
like image 535
jost21 Avatar asked Oct 11 '25 17:10

jost21


1 Answers

This is a known issue in Node 14.5.0 caused by Gulp-dependency async-done which is using the deprecated domain module, which shows this warning.

According to a post in the linked Gulp issue the deprecation error was not intentional in the context that Gulp used the related code.

In Node 14.6.0 this warning is no longer shown for all Gulp tasks tasks (your custom code could potentially trigger the warning though if your code somehow uses the module in the deprecated way).


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!