Elasticsearch APM with nodejs agent failing with error

Hi,

Problem:
I am using nodejs agent for APM server with the reference link:
"https://www.elastic.co/guide/en/apm/agent/js-base/current/getting-started.html"

Problem description:
From the above reference link, it was a single line snippet to initiate the agent.
var apm = initApm({serviceName: 'my-web-app',serverUrl: 'http://apm_server_ip:8200',serviceVersion: ''})

I could not find any output for this. So, debugged the output of the variable "apm" from browser console debugger. Below is the error details found from the object's response.
Am I doing anything wrong?
Please help me solve this issue.

Exception details (taken from browser console debug result):
TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
at Function.invokeGetter (:2:14)
at SafeSubscriber._next (http://localhost:4200/main.bundle.js:142:13)
at SafeSubscriber.webpackJsonp.../../../../rxjs/Subscriber.js.SafeSubscriber.__tryOrUnsub (http://localhost:4200/vendor.bundle.js:63625:16)
at SafeSubscriber.webpackJsonp.../../../../rxjs/Subscriber.js.SafeSubscriber.next (http://localhost:4200/vendor.bundle.js:63572:22)
at Subscriber.webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber._next (http://localhost:4200/vendor.bundle.js:63512:26)
at Subscriber.webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber.next (http://localhost:4200/vendor.bundle.js:63476:18)
at MapSubscriber.webpackJsonp.../../../../rxjs/operator/map.js.MapSubscriber._next (http://localhost:4200/vendor.bundle.js:74061:26)
at MapSubscriber.webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber.next (http://localhost:4200/vendor.bundle.js:63476:18)
at FilterSubscriber.webpackJsonp.../../../../rxjs/operator/filter.js.FilterSubscriber._next (http://localhost:4200/vendor.bundle.js:73062:30)
at FilterSubscriber.webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber.next (http://localhost:4200/vendor.bundle.js:63476:18)

Hi Abdul,

Thanks for reporting the issue, Could you please share your Webpack config?

From the error, it looks like a bundling issue to me, Are you trying to load the bundle lazily?

Thanks,
Vignesh

Hi,

This is implemented for our Angular 4 application. Are we supposed to use this approach for Angular application? If not, could you please let me know if there is any Angular specific agent configuration.

Hi Vignesh,

Could you please help on this.

Hi Abdul,

Yes I can help you, Our agent is not coupled to any frameworks. So it would work even if your application is built using Angular or React, It does not matter.

As I already mentioned, I believe the issue you are having is related to bundling and I would like you to test with inserting script tags in HTML directly instead of bundling to isolate the issue.

https://www.elastic.co/guide/en/apm/agent/js-base/3.x/getting-started.html#using-script-tags

Could you please test with above approach and let us know if you see any problems? Also if possible please share your webpack config, Would be easier for me to figure out the problem.

Thanks,
Vignesh

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.