# Elastic APM Angular Package Returns 400 with Angular 9

**URL:** <https://discuss.elastic.co/t/elastic-apm-angular-package-returns-400-with-angular-9/231343>\
**Category:** APM\
**Tags:** rum\
**Created:** [May 6, 2020, 1:11pm UTC](https://discuss.elastic.co/t/elastic-apm-angular-package-returns-400-with-angular-9/231343 "2020-05-06T13:11:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![edarioq](https://avatars.discourse-cdn.com/v4/letter/e/bc79bd/32.png) [@edarioq](https://discuss.elastic.co/u/edarioq)\
**Post date:** [May 6, 2020, 1:11pm UTC](https://discuss.elastic.co/t/elastic-apm-angular-package-returns-400-with-angular-9/231343/1 "2020-05-06T13:11:45Z")

</div>

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 🙂

**Kibana version** : 7.6.2

**Elasticsearch version** : 7.6.2

**APM Server version** : 7.6.2

**APM Agent language and version** : `@elastic/apm-rum-angular` 1.1.1. Angular 9.1.0

**Browser version** : Firefox 76.0b8

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**: Used the [Angular Integration](https://www.elastic.co/guide/en/apm/agent/rum-js/master/angular-integration.html) instructions

**Fresh install or upgraded from other version?**

**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.

Everything is running inside Docker containers with docker-compose  
APM is running on port 9200  
Enabled CORS in elasticsearch.yml, useing:

```
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers: X-Requested-With,X-Auth-Token,Content-Type, Content-Length

```

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:

 ![Screen Shot 2020-05-06 at 8.02.05 AM](https://us1.discourse-cdn.com/elastic/original/3X/4/f/4fe11edf359b61d2d05ede5384162ad80f4bcf53.png)

**Errors in browser console (if relevant)**:

[Elastic APM] Failed sending events! Error: "[http://localhost:9200/intake/v2/rum/events](http://localhost:9200/intake/v2/rum/events) HTTP status: 400"

---

<div class="post-metadata">

**Author:** ![Hamidreza](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamidreza/32/21369_2.png) [@Hamidreza](https://discuss.elastic.co/u/Hamidreza)\
**Post date:** [May 7, 2020, 9:00am UTC](https://discuss.elastic.co/t/elastic-apm-angular-package-returns-400-with-angular-9/231343/2 "2020-05-07T09:00:51Z")

</div>

Hi @edarioq,

Thanks for reporting the issue.

Would you please find the response from APM Server to the `http://localhost:9200/intake/v2/rum/events` request (in the Network panel of devtools) and send it here?

Cheers,  
Hamid

---

<div class="post-metadata">

**Author:** ![edarioq](https://avatars.discourse-cdn.com/v4/letter/e/bc79bd/32.png) [@edarioq](https://discuss.elastic.co/u/edarioq)\
**Post date:** [May 10, 2020, 5:50pm UTC](https://discuss.elastic.co/t/elastic-apm-angular-package-returns-400-with-angular-9/231343/3 "2020-05-10T17:50:28Z")

</div>

Hello @Hamidreza. I fixed it by installing APM server with Docker alongside the other services and making the call to that instead of Elastic directly. The errors are appearing correctly now. Thanks.

In the `docker-compose.yml` file:

```auto
  apm-server:
    image: docker.elastic.co/apm/apm-server:7.6.2
    container_name: apm-server
    command: >
      apm-server -e
        -E apm-server.rum.enabled=true
        -E apm-server.rum.event_rate.limit=300
        -E apm-server.rum.event_rate.lru_size=1000
        -E apm-server.rum.allow_origins=['*']
        -E apm-server.rum.library_pattern="node_modules|bower_components|~"
        -E apm-server.rum.exclude_from_grouping="^/webpack"
        -E apm-server.rum.source_mapping.enabled=true
        -E apm-server.rum.source_mapping.cache.expiration=5m
        -E apm-server.rum.source_mapping.index_pattern="apm-*"
        -E setup.kibana.host=kibana:5601
        -E apm-server.kibana.enabled=true
        -E apm-server.kibana.host=kibana:5601
        -E output.elasticsearch.hosts=["elastic:9200"]
    volumes:
      - logs_data:/logs
      - data01:/usr/share/apm-server/data
    ports:
      - 8200:8200
    depends_on:
      - elastic
    networks:
      - observability

```

And now in Angular I just send it to `localhost:8200` insead of `localhost:9200`.

```auto
const apm = service.init({
      serviceName: 'frontend',
      serverUrl: 'http://localhost:8200/', // APM Server
      serviceVersion: '1.0.0',
    });

```

---

<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:** [May 31, 2020, 1:50pm UTC](https://discuss.elastic.co/t/elastic-apm-angular-package-returns-400-with-angular-9/231343/4 "2020-05-31T13:50:33Z")

</div>

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