Elastic APM js agent for angular throws console error Cannot read property 'events'

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text :slight_smile:

Kibana version: 7.4.0

Elasticsearch version: 7.4.0

APM Server version: 7.4.0

APM Agent language and version: JS agent 4.5.0. Angular 0.2.0.

Browser version:

Original install method (e.g. download page, yum, deb, from source, etc.) and version: windows

Fresh install or upgraded from other version? fresh install

Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.
No just the default

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
I have followed the instuctions on how to install the APM agent for angular and I saw this errro first.


based on this discussion I changed my polyfills to core-js/es7/reflect and now I see a new error.

Uncaught TypeError: Cannot read property 'events' of undefined

any idea how I can fix this?
Steps to reproduce:
1.
2.
3.

Errors in browser console (if relevant):
Uncaught TypeError: Cannot read property 'events' of undefined

Provide logs and/or server output (if relevant):

Hi Kartheek,

There seems to be a bug in the way we publish our Angular module and hence the dependency injection does not work properly.

I am already on it, Please follow it along here for the update https://github.com/elastic/apm-agent-rum-js/issues/437

Thanks,
Vignesh

@vigneshshanmugam thank you for your response. One question I have is do you recommend using this version of angular-rum in production environment or would be recommend us waiting for a stable version?

Hi Kartheek,

We have released a new version of @elastic/apm-rum-angular@0.2.1 which should fix the above issue. The ApmService provider would need explicit injection to make it work with Angular CLI. Please refer to the doc - https://www.elastic.co/guide/en/apm/agent/rum-js/master/angular-integration.html

You can use it in production right now, we did not release a major version 1.x since we might explore API changes in the future if required.

Let us know how it works out for you.

Thanks,
Vignesh

Thank you I will try the new version now.