fescobar / allure-docker-service-ui

Allure Docker Service UI provides a friendly user interface for frankescobar/allure-docker-service API container.
Apache License 2.0
83 stars 43 forks source link

Network Error when attempting to access UI #19

Closed klloveall closed 2 years ago

klloveall commented 3 years ago

Seems like basicaly the same issue as is happening in https://github.com/fescobar/allure-docker-service-ui/issues/4 however we've gone into the UI docker container and verified we're able to curl the URL configured and we've pulled the most recent docker images.

I tried following some of the debugging steps in https://github.com/fescobar/allure-docker-service/issues/108 and related issues, but there aren't any error messages in the test report server, so I don't believe that is the root cause there.

As a debugging step, I tried curl http://allure-test-report-qa.qa.local/allure-docker-service/projects/default -H "Accept: application/json" -H "Content-Type: application/json" and received back:

{"data":{"project":{"id":"default","reports":["http://allure-test-report-qa.qa.local/allure-docker-service/projects/default/reports/latest/index.html"],"reports_id":["latest"]}},"meta_data":{"message":"Project successfully obtained"}}

I'm not 100% sure what should have been expected there, but that seems somewhat correct?

Please let me know of any further debugging steps I can take to figure out what is going on here.

For context, we're trying to run this inside AWS' ECS so if there's anything weird or special we need to be doing for that, please let me know.

fescobar commented 3 years ago

@klloveall can you show the logs from the API and UI containers? Both containers are deployed in the same domain? I need to see what it's exactly your error.

klloveall commented 3 years ago

@fescobar Here's the logs from the report and UI servers; not much in here to go on unfortunately.

Report server logs:

  | 2021-06-25T17:45:55.189-05:00 | ALLURE_VERSION: 2.13.8
  | 2021-06-25T17:45:55.189-05:00 | Generating default report
  | 2021-06-25T17:45:55.194-05:00 | Configuration by default
  | 2021-06-25T17:45:55.194-05:00 | Checking Allure Results every 1 second/s
  | 2021-06-25T17:45:55.214-05:00 | Creating executor.json for PROJECT_ID: default
  | 2021-06-25T17:45:55.218-05:00 | Generating report for PROJECT_ID: default
  | 2021-06-25T17:45:55.692-05:00 | [INFO] /app/allure-docker-api/app.py:290 Setting SECURITY_ENABLED=0 by default
  | 2021-06-25T17:45:57.887-05:00 | Report successfully generated to /app/allure-docker-api/static/projects/default/reports/latest
  | 2021-06-25T17:45:57.973-05:00 | Status: 200
  | 2021-06-25T17:45:58.459-05:00 | 2021-06-25 22:45:58.456:INFO::main: Logging initialized @404ms to org.eclipse.jetty.util.log.StdErrLog
  | 2021-06-25T17:46:00.201-05:00 | Detecting results changes for PROJECT_ID: default
  | 2021-06-25T17:46:00.205-05:00 | Automatic Execution in Progress for PROJECT_ID: default...
  | 2021-06-25T17:46:00.214-05:00 | Creating executor.json for PROJECT_ID: default
  | 2021-06-25T17:46:00.216-05:00 | Generating report for PROJECT_ID: default
  | 2021-06-25T17:46:02.999-05:00 | Report successfully generated to /app/allure-docker-api/static/projects/default/reports/latest
  | 2021-06-25T17:46:03.036-05:00 | Status: 200

UI Server Logs:

  | 2021-06-25T18:02:37.667-05:00 | ALLURE_UI_VERSION: 7.0.3
  | 2021-06-25T18:02:37.668-05:00 | ALLURE_DOCKER_API_URL=http://allure-test-report-qa.qa.local/allure-docker-service
  | 2021-06-25T18:02:37.668-05:00 | ROUTER_BASE_NAME=/allure-docker-service-ui

The error that's occurring from the browser:

"Network Error"
Check if you have access to http://allure-test-report-qa.qa.local/allure-docker-service
Or pull the latest "frankescobar/allure-docker-service" API image (remove your current latest version)
{"message":"Network Error","name":"Error","stack":"Error: Network Error\n at e.exports (https://test-reports.shipwell.com/static/js/2.fc83d11e.chunk.js:2:70398)\n at XMLHttpRequest.p.onerror (https://test-reports.shipwell.com/static/js/2.fc83d11e.chunk.js:2:69367)","config":{"url":"/config","method":"get","headers":{"Accept":"application/json, text/plain, */*"},"baseURL":"http://allure-test-report-qa.qa.local/allure-docker-service","transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"withCredentials":true}}
ardz commented 3 years ago

was there any update on this?

I too am unable to use this tool because of the network error issue

fescobar commented 3 years ago

@ardz You have to deploy both containers in the same domain.

ardz commented 3 years ago

@fescobar hi thanks for the reply, much appreciated

can you expand on what you mean? I've just used the sample docker compose file the containers are in the same domain as far I know?

is this potentially a CORS issue @fescobar ?

ardz commented 3 years ago

@fescobar

`version: '3' services: allure: image: "frankescobar/allure-docker-service:2.13.8" environment: CHECK_RESULTS_EVERY_SECONDS: NONE KEEP_HISTORY: 1 KEEP_HISTORY_LATEST: 25 ports:

jarPlanday commented 2 years ago

@ardz not sure if you still have the issue, but to me, it works fine on Firefox, but not on Chrome (as of March 2022). I think the reason is because Chrome doesn't send the Sec-fetch-Site: same-site that Firefox sends. Anyway, using Chrome or Edge works for me. The other option is to have a reverse proxy in front or the two containers; that way all the requests will come from the same host:port

fescobar commented 2 years ago

https://github.com/fescobar/allure-docker-service-ui/issues/19#issuecomment-903099100

Instead of using http://localhost:5050/ why don't try using the name of your service? It would be ALLURE_DOCKER_PUBLIC_API_URL: "http://allure:5050/". It's allure because that is the name of your service

services:
  allure:
    image: "frankescobar/allure-docker-service:2.13.8"
fescobar commented 2 years ago

https://github.com/fescobar/allure-docker-service-ui/issues/19#issuecomment-872550298

You have expose the api in a domain http://allure-test-report-qa.qa.local, I see that in your log http://allure-test-report-qa.qa.local/allure-docker-service. Then you need to expose the UI container in the same domain something like http://allure-test-report-qa.qa.local/allure-docker-service-ui.

fescobar commented 2 years ago

https://github.com/fescobar/allure-docker-service-ui/issues/19#issuecomment-1063570343 What are you using? docker-compose or kubernetes?

fescobar commented 2 years ago

As conclusion if you are exposing the API in any domain like http://my-domain.com/allure-docker-service, then you need to deploy in the same domain the UI container http://my-domain.com/allure-docker-service-ui where the http://my-domain.com is the domain name.

jarPlanday commented 2 years ago

#19 (comment) What are you using? docker-compose or kubernetes?

I was testing it locally via two separate docker containers, both exposing the ports. Now I'm running it via docker-compose and the same: doesn't work on Chrome but it works on Firefox. I think via the same domain it should work. I was just doing some tests locally and noticed the issue

fescobar commented 2 years ago

https://github.com/fescobar/allure-docker-service-ui/issues/19#issuecomment-1063850623 @jarPlanday Can you give more details like chrome version and configuration?

jarPlanday commented 2 years ago

@fescobar Version 99.0.4844.51 (Official Build) (32-bit)

This is a company's laptop. I'm not 100% sure about the internal configurations that the OS or Chrome could have.

I'm running the UI pointing to our internal allure-server. The same: chrome fails and FF works fine. Attached the request to /config as CURL commands

image

Checking locally, I /bin/bash to my allure-docker-service container and I changed the CORS setting, to accept all headers and sources (method after_request_func in app.py), but that didn't change the problem. I think is strictly an issue with Chrome (I don't have a personal laptop where to test the issue)

fescobar commented 2 years ago

@jarPlanday

  1. are you enabling the security?
  2. allure UI is deployed in the same domain than allure API is deployed. I mean https://allure-server....
  3. Did you enable https in the docker API container?
MynameisFragile commented 2 years ago

@jarPlanday Use https + api service domain instead of http , the only thing thats helps me this ALLURE_DOCKER_PUBLIC_API_URL: "https://allure-api.yourdomain.com/" instead of ALLURE_DOCKER_PUBLIC_API_URL: "http://allure:5050/"

and moreover to make everything work , u need to proxy api container too, give an example of nginx config

server { server_name allure.yourdomain.com;

location / {
    proxy_pass http://localhost:5252;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
}

location /allure-docker-service/ {
    proxy_pass http://localhost:5050/allure-docker-service/;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    rewrite ^/allure-docker-service/(.*) /$1 break;
}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/allure.yourdomain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/allure.yourdomain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server { if ($host = allure.yourdomain.com) { return 301 https://$host$request_uri; } # managed by Certbot

listen 80;
server_name allure.yourdomain.com;
return 404; # managed by Certbot

}

Kamalb2592 commented 2 years ago

@fescobar I am getting 401 error while login to UI. {"meta_data":{"message":"Invalid Token - Signature verification failed"}}

Also the Network log from browser says 401 unauthorized for below URL https://<service-url>/allure-api/allure-docker-service/config Request Method: GET Status Code: 401 Remote Address: 127.0.0.1:9000 Referrer Policy: strict-origin-when-cross-origin

palansher commented 2 weeks ago

Hello @Kamalb2592 !

Thank you for sharing nginx conf.

ALLURE_DOCKER_PUBLIC_API_URL: "https://allure-api.yourdomain.com/"

I am confused that allure-api.yourdomain.com domain is not part of your nginx proxy config.

I still in doubt: Must we use single domain for allure API and UI by CORS issues.. playing around with nginx redirects etc .. Or it is legal use two separate domains: allure-api.maydomain.com and allure-ui.maydomain.com ?

I think is comfortable for our developers to use just single UI entry point for allure reports: namely allure-ui.maydomain.com

and UI container will itself communicate with api container (allure-api.maydomain.com)