# Elasticsearch APM with nodejs agent failing with error

**URL:** <https://discuss.elastic.co/t/elasticsearch-apm-with-nodejs-agent-failing-with-error/166118>\
**Category:** APM\
**Created:** [January 29, 2019, 9:26am UTC](https://discuss.elastic.co/t/elasticsearch-apm-with-nodejs-agent-failing-with-error/166118 "2019-01-29T09:26:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![abdulsofts](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@abdulsofts](https://discuss.elastic.co/u/abdulsofts)\
**Post date:** [January 29, 2019, 9:26am UTC](https://discuss.elastic.co/t/elasticsearch-apm-with-nodejs-agent-failing-with-error/166118/1 "2019-01-29T09:26:28Z")

</div>

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](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](http://localhost:4200/main.bundle.js:142:13))  
at SafeSubscriber.webpackJsonp.../../../../rxjs/Subscriber.js.SafeSubscriber.\_\_tryOrUnsub ([http://localhost:4200/vendor.bundle.js:63625:16](http://localhost:4200/vendor.bundle.js:63625:16))  
at SafeSubscriber.webpackJsonp.../../../../rxjs/Subscriber.js.SafeSubscriber.next ([http://localhost:4200/vendor.bundle.js:63572:22](http://localhost:4200/vendor.bundle.js:63572:22))  
at Subscriber.webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber.\_next ([http://localhost:4200/vendor.bundle.js:63512:26](http://localhost:4200/vendor.bundle.js:63512:26))  
at Subscriber.webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber.next ([http://localhost:4200/vendor.bundle.js:63476:18](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](http://localhost:4200/vendor.bundle.js:74061:26))  
at MapSubscriber.webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber.next ([http://localhost:4200/vendor.bundle.js:63476:18](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](http://localhost:4200/vendor.bundle.js:73062:30))  
at FilterSubscriber.webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber.next ([http://localhost:4200/vendor.bundle.js:63476:18](http://localhost:4200/vendor.bundle.js:63476:18))

---

<div class="post-metadata">

**Author:** ![vigneshshanmugam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vigneshshanmugam/32/40324_2.png) [@vigneshshanmugam](https://discuss.elastic.co/u/vigneshshanmugam)\
**Post date:** [January 29, 2019, 9:45am UTC](https://discuss.elastic.co/t/elasticsearch-apm-with-nodejs-agent-failing-with-error/166118/2 "2019-01-29T09:45:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![abdulsofts](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@abdulsofts](https://discuss.elastic.co/u/abdulsofts)\
**Post date:** [January 29, 2019, 1:13pm UTC](https://discuss.elastic.co/t/elasticsearch-apm-with-nodejs-agent-failing-with-error/166118/3 "2019-01-29T13:13:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![abdulsofts](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@abdulsofts](https://discuss.elastic.co/u/abdulsofts)\
**Post date:** [January 30, 2019, 5:39am UTC](https://discuss.elastic.co/t/elasticsearch-apm-with-nodejs-agent-failing-with-error/166118/4 "2019-01-30T05:39:15Z")

</div>

Hi Vignesh,

Could you please help on this.

---

<div class="post-metadata">

**Author:** ![vigneshshanmugam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vigneshshanmugam/32/40324_2.png) [@vigneshshanmugam](https://discuss.elastic.co/u/vigneshshanmugam)\
**Post date:** [January 30, 2019, 10:00am UTC](https://discuss.elastic.co/t/elasticsearch-apm-with-nodejs-agent-failing-with-error/166118/5 "2019-01-30T10:00:05Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 20, 2019, 6:00am UTC](https://discuss.elastic.co/t/elasticsearch-apm-with-nodejs-agent-failing-with-error/166118/6 "2019-02-20T06:00:07Z")

</div>

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