diff --git a/src/node.cc b/src/node.cc index fa9c3626aa95f3..d51537f5ffb366 100644 --- a/src/node.cc +++ b/src/node.cc @@ -4279,12 +4279,13 @@ static void StartNodeInstance(void* arg) { if (instance_data->use_debug_agent()) StartDebug(env, debug_wait_connect); + env->set_trace_sync_io(trace_sync_io); + { Environment::AsyncCallbackScope callback_scope(env); LoadEnvironment(env); } - env->set_trace_sync_io(trace_sync_io); // Enable debugger if (instance_data->use_debug_agent())