newrelic / node-newrelic

New Relic Node.js agent code base. Developers are welcome to create pull requests here, please see our contributing guidelines. For New Relic technical support, please go to http://support.newrelic.com.
Apache License 2.0
969 stars 399 forks source link

Node 11 & 12 Support #279

Closed michaelgoin closed 5 years ago

michaelgoin commented 5 years ago

The agent does not yet officially support Node versions 11 & 12.

We will be opening up the engines restriction, in a release to follow soon, to allow those who would like to take advantage of agent features on newer versions of node. Using the agent in these situations will come with some additional risk. While the agent should work well for most standard cases, there may be some subtly broken features.

This issue will serve as a place to add any discovered issues/incompatibilities with Node 11 & 12. It should help inform if there are any risks too large to take on in your own project and will also help inform our official support as we tackle that.

michaelgoin commented 5 years ago

Node 11/12 Module Load changes break our shim._moduleRoot / shim.require() code paths.

Current agent tests do not yet catch the bug.

[UPDATE]: Known Impacts:

This issue has a corresponding internal NR issue for tracking.

johncblandii commented 5 years ago

Is there an expected timing here? This is blocking us upgrading Node versions.

michaelgoin commented 5 years ago

Hi @johncblandii,

The engine restriction change was just released and is available with v5.10.0.

Official support timing is still TBD.

Thanks,

Michael

johncblandii commented 5 years ago

BEAUTIFUL! We just reverted some docker images for lower Node versions, but look forward to upgrading them now. Thanks a ton!

drwharris commented 5 years ago

Not that I think there will be any, but how do you want issues reported? In this issue or log them separately?

I have just updated one of our apps to 5.10 on Node 12.3.1.

drwharris commented 5 years ago

Not that I think there will be any, but how do you want issues reported? In this issue or log them separately?

I have just updated one of our apps to 5.10 on Node 12.3.1.

So I only came upon this because I noticed that an app (our canary app) which we had upgraded NR to 5.9.x had stopped reporting transactions. Investigation led me to this Issue. After 15 min of running with 5.10.0 I am sill not seeing any transactions logged. I have also tried running through locally to see what the NR log shows but nothing useful there. I get these 4 lines and thats it regardless of running a number transactions through:

{"v":0,"level":30,"name":"newrelic","hostname":"DESKTOP-05F3LSM","pid":21724,"time":"2019-06-16T21:59:05.736Z","msg":"Using New Relic for Node.js. Agent version: 5.10.0; Node version: v12.3.1."} {"v":0,"level":30,"name":"newrelic","hostname":"DESKTOP-05F3LSM","pid":21724,"time":"2019-06-16T21:59:06.257Z","msg":"Starting New Relic for Node.js connection process."} {"v":0,"level":30,"name":"newrelic","hostname":"DESKTOP-05F3LSM","pid":21724,"time":"2019-06-16T21:59:10.050Z","msg":"Connected to collector-002.newrelic.com:443 with agent run ID BIFuIqKdfAlbAAfQCQlF8wBdBrwcAAgBAAAjHQECBAlF8v4DAAY1LjEwLjAAD0RFU0tUT1AtMDVGM0xTTQAQVHJhY2tlciBCYWNrIEVuZA.","component":"collector_api"} {"v":0,"level":30,"name":"newrelic","hostname":"DESKTOP-05F3LSM","pid":21724,"time":"2019-06-16T21:59:10.051Z","msg":"Reporting to: https://rpm.newrelic.com/accounts/[Account ID]/applications/[App ID]","component":"collector_api"}

astormnewrelic commented 5 years ago

@drwharris Thanks for giving the agent a try with Node 12!

Not that I think there will be any, but how do you want issues reported? In this issue or log them separately?

If you have an issue related to Node 11 or Node 12, please report it to this thread for the time being. If things get out of control we'll start breaking them up into individual issues, but a single thread seems like the best path forward for now. Also -- expect issues :). We're opening up the engines restrictions to give smart teams the ability to make their own choices w/r/t to trying out the agent in Node 12, but it's still not officially supported.

For issues not related to Node 11/12 -- your best bet will be to use our official support channels (support@newrelic.com) or New Relic's explorer's hub community forums. Or, you know, if you have a quick fix a PR discussion is always welcome :)

So I only came upon this because I noticed that an app (our canary app) which we had upgraded NR to 5.9.x had stopped reporting transactions.

Are you saying this application isn't reporting transaction when you switch to Node 12? If so, could you share your package.json requirments and and/or give us a brief overview of your application/service architecture? (express serving URLs? hapi behind a cache layer? TypeScript dynamically compiled on the fly and etc.). The more we know about your system the better we'll be able to track down what's going on with your system.

Thanks again for giving the agent a try with Node 12.

jbecwar commented 5 years ago

It tried 5.10 on two projects on the same machine, the first project worked great, but the second project I get an error building the native-metrics:

james@james-XPS-15-9570:~/ams_repos/AMS-virus-scan-api$ npm install

> @newrelic/native-metrics@4.1.0 install /home/james/ams_repos/AMS-virus-scan-api/node_modules/@newrelic/native-metrics
> node ./lib/pre-build.js install native_metrics

============================================================================
Attempting install in native-metrics module. Please note that this is an
OPTIONAL dependency, and any resultant errors in this process will not
affect the general performance of the New Relic agent, but event loop and
garbage collection metrics will not be collected.
============================================================================

> /home/james/.nvm/versions/node/v12.4.0/bin/node /home/james/.nvm/versions/node/v12.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean configure
> /home/james/.nvm/versions/node/v12.4.0/bin/node /home/james/.nvm/versions/node/v12.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build -j 3 native_metrics
make: Entering directory '/home/james/ams_repos/AMS-virus-scan-api/node_modules/@newrelic/native-metrics/build'
  CXX(target) Release/obj.target/native_metrics/src/native_metrics.o
  CXX(target) Release/obj.target/native_metrics/src/GCBinder.o
  CXX(target) Release/obj.target/native_metrics/src/LoopChecker.o
In file included from ../../../nan/nan_converters.h:67:0,
                 from ../../../nan/nan.h:222,
                 from ../src/LoopChecker.hpp:3,
                 from ../src/LoopChecker.cpp:5:
../../../nan/nan_converters_43_inl.h: In static member function ‘static Nan::imp::ToFactoryBase<v8::Boolean>::return_t Nan::imp::ToFactory<v8::Boolean>::convert(v8::Local<v8::Value>)’:
../../../nan/nan_converters_43_inl.h:18:51: warning: ‘v8::MaybeLocal<v8::Boolean> v8::Value::ToBoolean(v8::Local<v8::Context>) const’ is deprecated: ToBoolean can never throw. Use Local version. [-Wdeprecated-declarations]
       val->To ## TYPE(isolate->GetCurrentContext())                            \
                                                   ^
../../../nan/nan_converters_43_inl.h:22:1: note: in expansion of macro ‘X’
 X(Boolean)
 ^
In file included from /home/james/.node-gyp/12.4.0/include/node/v8-internal.h:14:0,
                 from /home/james/.node-gyp/12.4.0/include/node/v8.h:25,
                 from /home/james/.node-gyp/12.4.0/include/node/node.h:63,
                 from ../../../nan/nan.h:53,
                 from ../src/LoopChecker.hpp:3,
                 from ../src/LoopChecker.cpp:5:
/home/james/.node-gyp/12.4.0/include/node/v8.h:2524:63: note: declared here
                     V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
                                                               ^
/home/james/.node-gyp/12.4.0/include/node/v8config.h:322:3: note: in definition of macro ‘V8_DEPRECATE_SOON’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../../../nan/nan_converters.h:67:0,
                 from ../../../nan/nan.h:222,
                 from ../src/native_metrics.cpp:2:
../../../nan/nan_converters_43_inl.h: In static member function ‘static Nan::imp::ToFactoryBase<v8::Boolean>::return_t Nan::imp::ToFactory<v8::Boolean>::convert(v8::Local<v8::Value>)’:
../../../nan/nan_converters_43_inl.h:18:51: warning: ‘v8::MaybeLocal<v8::Boolean> v8::Value::ToBoolean(v8::Local<v8::Context>) const’ is deprecated: ToBoolean can never throw. Use Local version. [-Wdeprecated-declarations]
       val->To ## TYPE(isolate->GetCurrentContext())                            \
                                                   ^
../../../nan/nan_converters_43_inl.h:22:1: note: in expansion of macro ‘X’
 X(Boolean)
 ^
In file included from /home/james/.node-gyp/12.4.0/include/node/v8-internal.h:14:0,
                 from /home/james/.node-gyp/12.4.0/include/node/v8.h:25,
                 from /home/james/.node-gyp/12.4.0/include/node/node.h:63,
                 from ../../../nan/nan.h:53,
                 from ../src/native_metrics.cpp:2:
/home/james/.node-gyp/12.4.0/include/node/v8.h:2524:63: note: declared here
                     V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
                                                               ^
/home/james/.node-gyp/12.4.0/include/node/v8config.h:322:3: note: in definition of macro ‘V8_DEPRECATE_SOON’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../../../nan/nan_converters.h:67:0,
                 from ../../../nan/nan.h:222,
                 from ../src/LoopChecker.hpp:3,
                 from ../src/LoopChecker.cpp:5:
../../../nan/nan_converters_43_inl.h: In static member function ‘static Nan::imp::ValueFactoryBase<bool>::return_t Nan::imp::ToFactory<bool>::convert(v8::Local<v8::Value>)’:
../../../nan/nan_converters_43_inl.h:37:57: warning: ‘v8::Maybe<bool> v8::Value::BooleanValue(v8::Local<v8::Context>) const’ is deprecated: BooleanValue can never throw. Use Isolate version. [-Wdeprecated-declarations]
   return val->NAME ## Value(isolate->GetCurrentContext());                     \
                                                         ^
../../../nan/nan_converters_43_inl.h:40:1: note: in expansion of macro ‘X’
 X(bool, Boolean)
 ^
In file included from /home/james/.node-gyp/12.4.0/include/node/v8-internal.h:14:0,
                 from /home/james/.node-gyp/12.4.0/include/node/v8.h:25,
                 from /home/james/.node-gyp/12.4.0/include/node/node.h:63,
                 from ../../../nan/nan.h:53,
                 from ../src/LoopChecker.hpp:3,
                 from ../src/LoopChecker.cpp:5:
/home/james/.node-gyp/12.4.0/include/node/v8.h:2562:51: note: declared here
                 V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue(
                                                   ^
/home/james/.node-gyp/12.4.0/include/node/v8config.h:307:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../../../nan/nan_converters.h:67:0,
                 from ../../../nan/nan.h:222,
                 from ../src/native_metrics.cpp:2:
../../../nan/nan_converters_43_inl.h: In static member function ‘static Nan::imp::ValueFactoryBase<bool>::return_t Nan::imp::ToFactory<bool>::convert(v8::Local<v8::Value>)’:
../../../nan/nan_converters_43_inl.h:37:57: warning: ‘v8::Maybe<bool> v8::Value::BooleanValue(v8::Local<v8::Context>) const’ is deprecated: BooleanValue can never throw. Use Isolate version. [-Wdeprecated-declarations]
   return val->NAME ## Value(isolate->GetCurrentContext());                     \
                                                         ^
../../../nan/nan_converters_43_inl.h:40:1: note: in expansion of macro ‘X’
 X(bool, Boolean)
 ^
In file included from /home/james/.node-gyp/12.4.0/include/node/v8-internal.h:14:0,
                 from /home/james/.node-gyp/12.4.0/include/node/v8.h:25,
                 from /home/james/.node-gyp/12.4.0/include/node/node.h:63,
                 from ../../../nan/nan.h:53,
                 from ../src/native_metrics.cpp:2:
/home/james/.node-gyp/12.4.0/include/node/v8.h:2562:51: note: declared here
                 V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue(
                                                   ^
/home/james/.node-gyp/12.4.0/include/node/v8config.h:307:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../../../nan/nan_new.h:189:0,
                 from ../../../nan/nan.h:223,
                 from ../src/LoopChecker.hpp:3,
                 from ../src/LoopChecker.cpp:5:
../../../nan/nan_implementation_12_inl.h: In static member function ‘static Nan::imp::FactoryBase<v8::StringObject>::return_t Nan::imp::Factory<v8::StringObject>::New(v8::Local<v8::String>)’:
../../../nan/nan_implementation_12_inl.h:356:37: error: no matching function for call to ‘v8::StringObject::New(v8::Local<v8::String>&)’
   return v8::StringObject::New(value).As<v8::StringObject>();
                                     ^
In file included from /home/james/.node-gyp/12.4.0/include/node/node.h:63:0,
                 from ../../../nan/nan.h:53,
                 from ../src/LoopChecker.hpp:3,
                 from ../src/LoopChecker.cpp:5:
/home/james/.node-gyp/12.4.0/include/node/v8.h:5380:23: note: candidate: static v8::Local<v8::Value> v8::StringObject::New(v8::Isolate*, v8::Local<v8::String>)
   static Local<Value> New(Isolate* isolate, Local<String> value);
                       ^~~
In file included from ../../../nan/nan_new.h:189:0,
                 from ../../../nan/nan.h:223,
                 from ../src/native_metrics.cpp:2:
../../../nan/nan_implementation_12_inl.h: In static member function ‘static Nan::imp::FactoryBase<v8::StringObject>::return_t Nan::imp::Factory<v8::StringObject>::New(v8::Local<v8::String>)’:
../../../nan/nan_implementation_12_inl.h:356:37: error: no matching function for call to ‘v8::StringObject::New(v8::Local<v8::String>&)’
   return v8::StringObject::New(value).As<v8::StringObject>();
                                     ^
/home/james/.node-gyp/12.4.0/include/node/v8.h:5380:23: note:   candidate expects 2 arguments, 1 provided
In file included from ../../../nan/nan_new.h:189:0,
                 from ../../../nan/nan.h:223,
                 from ../src/LoopChecker.hpp:3,
                 from ../src/LoopChecker.cpp:5:
../../../nan/nan_implementation_12_inl.h:356:58: error: expected primary-expression before ‘>’ token
   return v8::StringObject::New(value).As<v8::StringObject>();
                                                          ^
../../../nan/nan_implementation_12_inl.h:356:60: error: expected primary-expression before ‘)’ token
   return v8::StringObject::New(value).As<v8::StringObject>();
                                                            ^
In file included from /home/james/.node-gyp/12.4.0/include/node/node.h:63:0,
                 from ../../../nan/nan.h:53,
                 from ../src/native_metrics.cpp:2:
/home/james/.node-gyp/12.4.0/include/node/v8.h:5380:23: note: candidate: static v8::Local<v8::Value> v8::StringObject::New(v8::Isolate*, v8::Local<v8::String>)
   static Local<Value> New(Isolate* isolate, Local<String> value);
                       ^~~
/home/james/.node-gyp/12.4.0/include/node/v8.h:5380:23: note:   candidate expects 2 arguments, 1 provided
In file included from ../../../nan/nan_new.h:189:0,
                 from ../../../nan/nan.h:223,
                 from ../src/native_metrics.cpp:2:
../../../nan/nan_implementation_12_inl.h:356:58: error: expected primary-expression before ‘>’ token
   return v8::StringObject::New(value).As<v8::StringObject>();
                                                          ^
../../../nan/nan_implementation_12_inl.h:356:60: error: expected primary-expression before ‘)’ token
   return v8::StringObject::New(value).As<v8::StringObject>();
                                                            ^
In file included from ../../../nan/nan_converters.h:67:0,
                 from ../../../nan/nan.h:222,
                 from ../src/GCBinder.hpp:4,
                 from ../src/GCBinder.cpp:2:
../../../nan/nan_converters_43_inl.h: In static member function ‘static Nan::imp::ToFactoryBase<v8::Boolean>::return_t Nan::imp::ToFactory<v8::Boolean>::convert(v8::Local<v8::Value>)’:
../../../nan/nan_converters_43_inl.h:18:51: warning: ‘v8::MaybeLocal<v8::Boolean> v8::Value::ToBoolean(v8::Local<v8::Context>) const’ is deprecated: ToBoolean can never throw. Use Local version. [-Wdeprecated-declarations]
       val->To ## TYPE(isolate->GetCurrentContext())                            \
                                                   ^
../../../nan/nan_converters_43_inl.h:22:1: note: in expansion of macro ‘X’
 X(Boolean)
 ^
In file included from /home/james/.node-gyp/12.4.0/include/node/v8-internal.h:14:0,
                 from /home/james/.node-gyp/12.4.0/include/node/v8.h:25,
                 from /home/james/.node-gyp/12.4.0/include/node/node.h:63,
                 from ../../../nan/nan.h:53,
                 from ../src/GCBinder.hpp:4,
                 from ../src/GCBinder.cpp:2:
/home/james/.node-gyp/12.4.0/include/node/v8.h:2524:63: note: declared here
                     V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
                                                               ^
/home/james/.node-gyp/12.4.0/include/node/v8config.h:322:3: note: in definition of macro ‘V8_DEPRECATE_SOON’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../../../nan/nan_converters.h:67:0,
                 from ../../../nan/nan.h:222,
                 from ../src/GCBinder.hpp:4,
                 from ../src/GCBinder.cpp:2:
../../../nan/nan_converters_43_inl.h: In static member function ‘static Nan::imp::ValueFactoryBase<bool>::return_t Nan::imp::ToFactory<bool>::convert(v8::Local<v8::Value>)’:
../../../nan/nan_converters_43_inl.h:37:57: warning: ‘v8::Maybe<bool> v8::Value::BooleanValue(v8::Local<v8::Context>) const’ is deprecated: BooleanValue can never throw. Use Isolate version. [-Wdeprecated-declarations]
   return val->NAME ## Value(isolate->GetCurrentContext());                     \
                                                         ^
../../../nan/nan_converters_43_inl.h:40:1: note: in expansion of macro ‘X’
 X(bool, Boolean)
 ^
In file included from /home/james/.node-gyp/12.4.0/include/node/v8-internal.h:14:0,
                 from /home/james/.node-gyp/12.4.0/include/node/v8.h:25,
                 from /home/james/.node-gyp/12.4.0/include/node/node.h:63,
                 from ../../../nan/nan.h:53,
                 from ../src/GCBinder.hpp:4,
                 from ../src/GCBinder.cpp:2:
/home/james/.node-gyp/12.4.0/include/node/v8.h:2562:51: note: declared here
                 V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue(
                                                   ^
/home/james/.node-gyp/12.4.0/include/node/v8config.h:307:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from /usr/include/c++/7/cassert:44:0,
                 from /home/james/.node-gyp/12.4.0/include/node/node_object_wrap.h:26,
                 from ../../../nan/nan.h:55,
                 from ../src/LoopChecker.hpp:3,
                 from ../src/LoopChecker.cpp:5:
../../../nan/nan_object_wrap.h: In destructor ‘virtual Nan::ObjectWrap::~ObjectWrap()’:
../../../nan/nan_object_wrap.h:24:25: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’
     assert(persistent().IsNearDeath());
                         ^
In file included from /usr/include/c++/7/cassert:44:0,
                 from /home/james/.node-gyp/12.4.0/include/node/node_object_wrap.h:26,
                 from ../../../nan/nan.h:55,
                 from ../src/native_metrics.cpp:2:
../../../nan/nan_object_wrap.h: In destructor ‘virtual Nan::ObjectWrap::~ObjectWrap()’:
../../../nan/nan_object_wrap.h:24:25: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’
     assert(persistent().IsNearDeath());
                         ^
../../../nan/nan_object_wrap.h: In static member function ‘static void Nan::ObjectWrap::WeakCallback(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’:
../../../nan/nan_object_wrap.h:127:26: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’
     assert(wrap->handle_.IsNearDeath());
                          ^
../../../nan/nan_object_wrap.h: In static member function ‘static void Nan::ObjectWrap::WeakCallback(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’:
../../../nan/nan_object_wrap.h:127:26: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’
     assert(wrap->handle_.IsNearDeath());
                          ^
In file included from ../../../nan/nan_new.h:189:0,
                 from ../../../nan/nan.h:223,
                 from ../src/GCBinder.hpp:4,
                 from ../src/GCBinder.cpp:2:
../../../nan/nan_implementation_12_inl.h: In static member function ‘static Nan::imp::FactoryBase<v8::StringObject>::return_t Nan::imp::Factory<v8::StringObject>::New(v8::Local<v8::String>)’:
../../../nan/nan_implementation_12_inl.h:356:37: error: no matching function for call to ‘v8::StringObject::New(v8::Local<v8::String>&)’
   return v8::StringObject::New(value).As<v8::StringObject>();
                                     ^
In file included from /home/james/.node-gyp/12.4.0/include/node/node.h:63:0,
                 from ../../../nan/nan.h:53,
                 from ../src/GCBinder.hpp:4,
                 from ../src/GCBinder.cpp:2:
/home/james/.node-gyp/12.4.0/include/node/v8.h:5380:23: note: candidate: static v8::Local<v8::Value> v8::StringObject::New(v8::Isolate*, v8::Local<v8::String>)
   static Local<Value> New(Isolate* isolate, Local<String> value);
                       ^~~
/home/james/.node-gyp/12.4.0/include/node/v8.h:5380:23: note:   candidate expects 2 arguments, 1 provided
In file included from ../../../nan/nan_new.h:189:0,
                 from ../../../nan/nan.h:223,
                 from ../src/GCBinder.hpp:4,
                 from ../src/GCBinder.cpp:2:
../../../nan/nan_implementation_12_inl.h:356:58: error: expected primary-expression before ‘>’ token
   return v8::StringObject::New(value).As<v8::StringObject>();
                                                          ^
../../../nan/nan_implementation_12_inl.h:356:60: error: expected primary-expression before ‘)’ token
   return v8::StringObject::New(value).As<v8::StringObject>();
                                                            ^
In file included from /usr/include/c++/7/cassert:44:0,
                 from /home/james/.node-gyp/12.4.0/include/node/node_object_wrap.h:26,
                 from ../../../nan/nan.h:55,
                 from ../src/GCBinder.hpp:4,
                 from ../src/GCBinder.cpp:2:
../../../nan/nan_object_wrap.h: In destructor ‘virtual Nan::ObjectWrap::~ObjectWrap()’:
../../../nan/nan_object_wrap.h:24:25: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’
     assert(persistent().IsNearDeath());
                         ^
../../../nan/nan_object_wrap.h: In static member function ‘static void Nan::ObjectWrap::WeakCallback(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’:
../../../nan/nan_object_wrap.h:127:26: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’
     assert(wrap->handle_.IsNearDeath());
                          ^
native_metrics.target.mk:114: recipe for target 'Release/obj.target/native_metrics/src/LoopChecker.o' failed
make: *** [Release/obj.target/native_metrics/src/LoopChecker.o] Error 1
make: *** Waiting for unfinished jobs....
native_metrics.target.mk:114: recipe for target 'Release/obj.target/native_metrics/src/native_metrics.o' failed
make: *** [Release/obj.target/native_metrics/src/native_metrics.o] Error 1
native_metrics.target.mk:114: recipe for target 'Release/obj.target/native_metrics/src/GCBinder.o' failed
make: *** [Release/obj.target/native_metrics/src/GCBinder.o] Error 1
make: Leaving directory '/home/james/ams_repos/AMS-virus-scan-api/node_modules/@newrelic/native-metrics/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/james/.nvm/versions/node/v12.4.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.15.0-51-generic
gyp ERR! command "/home/james/.nvm/versions/node/v12.4.0/bin/node" "/home/james/.nvm/versions/node/v12.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "-j" "3" "native_metrics"
gyp ERR! cwd /home/james/ams_repos/AMS-virus-scan-api/node_modules/@newrelic/native-metrics
gyp ERR! node -v v12.4.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Failed to execute native-metrics install: No pre-built artifacts for your OS/architecture.
npm WARN ams-virus-scan-api@1.5.0 No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @newrelic/native-metrics@4.1.0 (node_modules/@newrelic/native-metrics):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @newrelic/native-metrics@4.1.0 install: `node ./lib/pre-build.js install native_metrics`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

audited 3451 packages in 5.089s
found 0 vulnerabilities

Both programs are using the same node install/ same g++/make/python

ccope commented 5 years ago

@jbecwar looks like you have an outdated version of nan installed. Make sure you have the most up-to-date version in your lockfile.

drwharris commented 5 years ago

@astormnewrelic, thanks for following up.

Are you saying this application isn't reporting transaction when you switch to Node 12?

Thats correct

If so, could you share your package.json requirments and

Is this what you want:

"dependencies": {
    "@sentry/node": "^5.4.0",
    "@types/amqplib": "^0.5.11",
    "@types/node": "^12.0.8",
    "@types/stack-trace": "0.0.29",
    "amqplib": "^0.5.3",
    "aws-sdk": "^2.473.0",
    "axios": "^0.19.0",
    "axios-retry": "^3.1.2",
    "maxmind": "^3.0.4",
    "mysql": "^2.17.1",
    "newrelic": "^5.10.0",
    "pkginfo": "^0.4.1",
    "winston": "^3.2.1"
}, "devDependencies": {
    "tslint": "^5.17.0",
    "typescript": "^3.5.1"
}

and/or give us a brief overview of your application/service architecture? (express serving URLs? hapi behind a cache layer? TypeScript dynamically compiled on the fly and etc.). The more we know about your system the better we'll be able to track down what's going on with your system.

Application is a Message Queue (Rabbit) Consumer which takes messages from a Queue, post processes them to validate data, make them consistent, add information like Geo coordinates, weather, etc and then inserts into a database.

Its written in typescript, compiled to JS at build time and deployed to a Docker image.

Here is the NR output from the build:

Step 8/9 : RUN npm install --production
 ---> Running in 3517adcc20d3

> @newrelic/native-metrics@4.1.0 install /usr/src/tracker/node_modules/@newrelic/native-metrics
> node ./lib/pre-build.js install native_metrics

============================================================================
Attempting install in native-metrics module. Please note that this is an
OPTIONAL dependency, and any resultant errors in this process will not
affect the general performance of the New Relic agent, but event loop and
garbage collection metrics will not be collected.
============================================================================

> /usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean configure
> /usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build -j 1 native_metrics
make: Entering directory '/usr/src/tracker/node_modules/@newrelic/native-metrics/build'
  CXX(target) Release/obj.target/native_metrics/src/native_metrics.o
  CXX(target) Release/obj.target/native_metrics/src/GCBinder.o
  CXX(target) Release/obj.target/native_metrics/src/LoopChecker.o
  CXX(target) Release/obj.target/native_metrics/src/RUsageMeter.o
  SOLINK_MODULE(target) Release/obj.target/native_metrics.node
  COPY Release/native_metrics.node
make: Leaving directory '/usr/src/tracker/node_modules/@newrelic/native-metrics/build'
install successful: _newrelic_native_metrics-4_1_0-native_metrics-72-linux-x64
added 112 packages from 201 contributors and audited 232 packages in 10.835s
found 0 vulnerabilities

It runs as a Fargate task (Non-host controlled Docker Container) on AWS.

Hope thats enough info?

drwharris commented 5 years ago

It tried 5.10 on two projects on the same machine, the first project worked great, but the second project I get an error building the native-metrics:

I had a similar issue. Delete node_modules and do npm install and it fixed the issue for me.

jbecwar commented 5 years ago

@ccope Thanks for the tip! On the project that wasn't working the package-lock.json had:

"@newrelic/native-metrics": {
      "version": "4.1.0",
      "resolved": "https://registry.npmjs.org/@newrelic/native-metrics/-/native-metrics-4.1.0.tgz",
      "integrity": "sha512-7CZlKMLuaYQW7mV9qVyo9b9HVe2xBnyn+kkETRJoZGs5P7gdfv9AAE3RPhtOBUopTfbmc8ju7njYadjui9J1XA==",
      "optional": true,
      "requires": {
        "nan": "^2.12.1",
        "semver": "^5.5.1"
      }
    },

The one that worked had:

"@newrelic/native-metrics": {
      "version": "4.1.0",
      "resolved": "https://registry.npmjs.org/@newrelic/native-metrics/-/native-metrics-4.1.0.tgz",
      "integrity": "sha512-7CZlKMLuaYQW7mV9qVyo9b9HVe2xBnyn+kkETRJoZGs5P7gdfv9AAE3RPhtOBUopTfbmc8ju7njYadjui9J1XA==",
      "optional": true,
      "requires": {
        "nan": "^2.12.1",
        "semver": "^5.5.1"
      },
      "dependencies": {
        "nan": {
          "version": "2.14.0",
          "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
          "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==",
          "optional": true
        }
      }
    },

if I replace the bad native-metrics object with the good one, it builds perfect. Only down side is if I regenerate the package-lock.json it reverts. It looks like the native-metrics project has an open PR for the issue: https://github.com/newrelic/node-native-metrics/pull/60/commits

drwharris commented 5 years ago

Hope thats enough info?

@astormnewrelic ??

drwharris commented 5 years ago

Does anyone have any advise on this?

astormnewrelic commented 5 years ago

@drwharris Thanks! The information you provided is great -- we've got an internal issue opened and we'll try to track down the issue when we tackle formal support for Node 12. We don't have a clear timeline yet for when we'll be doing that, but we'll be updating this issue as we progress. If you (or anyone) is urgently impacted by your application's not reporting in via Node 12 we recommend you roll back to an officially supported version of NodeJS.

The in meanwhile -- using your set of dependencies we spun up a simple express application, and data recorded correctly. So that means there's no gigantic failure state with your set of dependencies, which means the problem is likely down to the instrumentation on a specific module.

Can you

  1. Confirm that this worked in previous versions of Node?
  2. Share a code snippet of how you're pulling items off the queue and running them -- i.e. the code the does work that you expect to see transactions generated for.

Also -- have you tried upping the logs to trace level and checking if there's anything unexpected showing up there?

#File: newrelic.js
exports.config = {
    /* ... */
    logging: {
        /**
         * Level at which to log. 'trace' is most useful to New Relic when diagnosing
         * issues with the agent, 'info' and higher will impose the least overhead on
         * production applications.
         */
        level: 'trace'
    },    
    /* ... */
}
drwharris commented 5 years ago

@drwharris Thanks! The information you provided is great -- we've got an internal issue opened and we'll try to track down the issue when we tackle formal support for Node 12. We don't have a clear timeline yet for when we'll be doing that, but we'll be updating this issue as we progress. If you (or anyone) is urgently impacted by your application's not reporting in via Node 12 we recommend you roll back to an officially supported version of NodeJS.

Will do. Its not difficult for me to replicate this.

The in meanwhile -- using your set of dependencies we spun up a simple express application, and data recorded correctly. So that means there's no gigantic failure state with your set of dependencies, which means the problem is likely down to the instrumentation on a specific module.

We aren't using Express, we're using Restify.

Can you

  1. Confirm that this worked in previous versions of Node?

100% worked fine. newrelic

  1. Share a code snippet of how you're pulling items off the queue and running them -- i.e. the code the does work that you expect to see transactions generated for.

Would you like me to make you a RO contributor on our repository so you can see 1st hand?

Also -- have you tried upping the logs to trace level and checking if there's anything unexpected showing up there?

Yes, this was the first thing I did.

astormnewrelic commented 5 years ago

@drwharris

Would you like me to make you a RO contributor on our repository so you can see 1st hand?

A stand-alone reproduction would be our first choice, but if you're comfortable giving out RO access and pointing at an example then that's a close-second.

drwharris commented 5 years ago

Just realised I said this was using Restify. This particular app is not using any http front end, thats the opposite side of this app, our Message Queue Producer. This app is our Message Queue Consumer, so just sits and listens for messages on a Rabbit MQ queue.

I will try and put together a quick repro.

drwharris commented 5 years ago

Here is a repro. It starts up a consumer and pushes something into the queue every 5 seconds. After 10 min of this running I still had nothing I can see as why in the log and nothing online. (note you will need to place a license_key in the newrelic.js file).

It expects a local instance of Rabbit MQ with default guest/guest user. You can get this simply with docker using

docker run -d -p 5672:5672 -p 15672:15672 --name rabbitmq rabbitmq:3-management

nrrepro.zip

astormnewrelic commented 5 years ago

@drwharris Perfect, thank you. Looking at the reproduction case, I noticed this was present in the trace logs for V12 and it wasn't present for V10.

Failed to load "./lib/channel": Error: Cannot find module '/
Could not get Channel class to instrument.
Failed to load "./lib/callback_model": Error: Cannot find mo
Could not get callback model Channel to instrument

Its too early to say why this is happening -- hopefully this is just a change in how Node 12 resolves its module paths and we can make adjustments. Mainly mentioning this in case something jumps out for you'all. We'll keep you posted as we discover more.

astormnewrelic commented 5 years ago

@drwharris TL;DR -- keep an eye out for an agent release coming "soon" :)

We've looked into this and it seems like there's been some changes in how the NodeJS internals handle module loading, and these changes don't play nicely with a combination the patching we do for instrumentation and the relative paths we use in the amqp instrumentation.

We're testing out some changes that should fix this and we'll have a fix out soon. Keep an eye on the agent release page for a fix.

michaelgoin commented 5 years ago

Also, for additional clarity for anyone reviewing this, this is the same issue documented above "Node 11/12 Module Load changes break our shim._moduleRoot / shim.require() code paths.".

drwharris commented 5 years ago

Thank all. Waiting (im)patiently :)

Oxicode commented 5 years ago

Alguna novedad?

drwharris commented 5 years ago

Alguna novedad?

^^ what he said! @astormnewrelic ?

jufemaiz commented 5 years ago

We're nearly three months on. Any word @astormnewrelic ?

johncblandii commented 5 years ago

It was released a while back.

astormnewrelic commented 5 years ago

@Oxicode @drwharris @jufemaiz Thanks all for checking in!

Steady goes the course. We're still planning/working-on formal support for the latest version of Node, and we're still interested in any bug/problems/behaviors folks have with running the current agent with the latest version of Node. So keep any problems you're seeing coming!

daveisfera commented 5 years ago

@newrelic/native-metrics doesn't install in the official node 12 docker image (works just fine with the node 10 docker image):

> docker run --rm -it node:12.10.0-alpine yarn add newrelic
yarn add v1.17.3
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
warning Error running install script for optional dependency: "/node_modules/@newrelic/native-metrics: Command failed.
Exit code: 1
Command: node ./lib/pre-build.js install native_metrics
Arguments: 
Directory: /node_modules/@newrelic/native-metrics
Output:
============================================================================
Attempting install in native-metrics module. Please note that this is an
OPTIONAL dependency, and any resultant errors in this process will not
affect the general performance of the New Relic agent, but event loop and
garbage collection metrics will not be collected.
============================================================================

> /usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean configure
gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.3
gyp info using node@12.10.0 | linux | x64
gyp ERR! find Python 
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if \"python\" can be used
gyp ERR! find Python - \"python\" is not in PATH or produced an error
gyp ERR! find Python checking if \"python2\" can be used
gyp ERR! find Python - \"python2\" is not in PATH or produced an error
gyp ERR! find Python 
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python 2.7.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python=\"/path/to/pythonexecutable\"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python \"/path/to/pythonexecutable\"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python 
gyp ERR! configure error 
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:303:47)
gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:132:21)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:175:16)
gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:267:16)
gyp ERR! stack     at exithandler (child_process.js:302:5)
gyp ERR! stack     at ChildProcess.errorhandler (child_process.js:314:5)
gyp ERR! stack     at ChildProcess.emit (events.js:209:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
gyp ERR! stack     at onErrorNT (internal/child_process.js:456:16)
gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js:80:21)
gyp ERR! System Linux 4.9.184-linuxkit
gyp ERR! command \"/usr/local/bin/node\" \"/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"clean\" \"configure\"
gyp ERR! cwd /node_modules/@newrelic/native-metrics
gyp ERR! node -v v12.10.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok 
Failed to execute native-metrics install: No pre-built artifacts for your OS/architecture."
info This module is OPTIONAL, you can safely ignore this error
success Saved lockfile.
success Saved 21 new dependencies.
info Direct dependencies
└─ newrelic@5.11.0
info All dependencies
├─ @newrelic/koa@1.0.8
├─ @newrelic/superagent@1.0.3
├─ @tyriar/fibonacci-heap@2.0.9
├─ agent-base@4.3.0
├─ async@2.6.3
├─ buffer-from@1.1.1
├─ concat-stream@2.0.0
├─ debug@3.2.6
├─ es6-promise@4.2.8
├─ es6-promisify@5.0.0
├─ https-proxy-agent@2.2.2
├─ json-stringify-safe@5.0.1
├─ lodash@4.17.15
├─ ms@2.1.2
├─ newrelic@5.11.0
├─ readable-stream@3.4.0
├─ safe-buffer@5.2.0
├─ semver@5.7.1
├─ string_decoder@1.3.0
├─ typedarray@0.0.6
└─ util-deprecate@1.0.2
Done in 4.97s.
jufemaiz commented 5 years ago

node-gyp depends on python.

You’ll need to install python. Recommend using a build container 👍🏼

daveisfera commented 5 years ago

I understand that, but python isn't installed in the node 10 images and the above command completes without any issues:

> docker run --rm -it node:10.16.3-alpine yarn add newrelic
yarn add v1.17.3
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 23 new dependencies.
info Direct dependencies
└─ newrelic@5.11.0
info All dependencies
├─ @newrelic/koa@1.0.8
├─ @newrelic/native-metrics@4.1.0
├─ @newrelic/superagent@1.0.3
├─ @tyriar/fibonacci-heap@2.0.9
├─ agent-base@4.3.0
├─ async@2.6.3
├─ buffer-from@1.1.1
├─ concat-stream@2.0.0
├─ debug@3.2.6
├─ es6-promise@4.2.8
├─ es6-promisify@5.0.0
├─ https-proxy-agent@2.2.2
├─ json-stringify-safe@5.0.1
├─ lodash@4.17.15
├─ ms@2.1.2
├─ nan@2.14.0
├─ newrelic@5.11.0
├─ readable-stream@3.4.0
├─ safe-buffer@5.2.0
├─ semver@5.7.1
├─ string_decoder@1.3.0
├─ typedarray@0.0.6
└─ util-deprecate@1.0.2
Done in 5.38s.
jufemaiz commented 5 years ago

Perhaps worthwhile registering at https://github.com/newrelic/node-native-metrics/issues

michaelgoin commented 5 years ago

We shipped official Node 12 parity support yesterday!

Here's the release notes for more information on release 6.0.0.

There's one final potential issue with native metrics you can follow here: https://github.com/newrelic/node-native-metrics/issues/62. For the most part, issues we've seen with native metrics modules have been around needing to upgrade dependencies to build against the Node 12 API but we do have fall-back binaries for install now.

Closing this issue out in the main agent repo.