LABs 5.4. petclinic-react does not show up, CORS policy error on PetClinic page

Course: Elastic Observability Engineer
Version: 7.9

Hello,

I cannot figure out how to solve this. I all the steps in 5.4. seem to be successful but at the end petclinic-react does not show up on Elastic APM. Chrome DevTools suggests that RUM event traffic is blocked by CORS policy:

image

Hi @Renata ,

are you accessing Petclinic through HTTP? If you are using HTTPS there might be an issue between the connection of the agent running in the browser and the APM server running on your lab environment.

Best,
Andre

Hello Andre,

the hyperlink is provided in LABs document. It is http, as browser complains that it is not secure. I tried different browsers, different internet connections, different PCs. Same error.

Hi @Renata ,

can you please share the content of the config.js file you have for petclinic-client?

Please also send us the result of running sudo docker logs petclinic-client.

Best,
Andre

Hello Andre,

for config.js ELASTIC_APM_SERVER_JS_URL I would obviously copy the current IP given on the terminal Machine Info. But overall the file content as follows:

> var config = {
>   apm_server: process.env.ELASTIC_APM_SERVER_URL || 'http://apm-server:8200',
>   apm_server_js: process.env.ELASTIC_APM_SERVER_JS_URL ||'ec2-52-51-136-26.eu-west-1.compute.amazonaws.com:8200',
>   apm_service_name: process.env.ELASTIC_APM_SERVICE_NAME || 'petclinic-node',
>   apm_client_service_name: process.env.ELASTIC_APM_CLIENT_SERVICE_NAME || 'petclinic-react',
>   apm_service_version: process.env.ELASTIC_APM_SERVICE_VERSION || '1.0.0',
>   api_server: process.env.API_SERVER || 'http://petclinic-server:8000',
>   api_prefix: process.env.API_PREFIX || '/petclinic/api',
>   address_server: process.env.ADDRESS_SERVER || 'http://address-finder:5000',
>   distributedTracingOrigins: process.env.DISTRIBUTED_TRACINGS_ORIGINS || 'http://petclinic-client:4000,http://petclinic-server:8000,http://localhost:4000,http://localhost:8080,http://localhost:8081'
> }

As for running sudo docker logs petclinic-client - it asks for a password for 'elastic' and well I did not manage to guess it...

Hi @Renata ,

please try adding http:// prefix to your Public IP and port set in apm_server_js.

Also, have you enabled RUM in your APM Server and restarted it?

Best,
Andre

Hello Andre,

ok, so though I spent over 3 hours trying to make it work, never thought about adding http. And now it works! It was that simple. Thank you for support :slight_smile:

/Renata

Hi @Renata ,

I'm sorry to hear you lost time, but I'm glad it worked out.

Best,
Andre

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