server-client-python icon indicating copy to clipboard operation
server-client-python copied to clipboard

400080: Bad Request There was a problem querying the pdf for view "<UUID>"

Open septatrix opened this issue 3 years ago • 6 comments

Describe the bug Requesting PDF fails erratically. The API reference lists "The view ID in the URI doesn't correspond to a view available on the specified site." as the detail. This, however, does not seem to be the problem as simply retrying the request usually works without problems. As a workaround we currently retry three times, though even then we sometimes do not get a successful response.

Versions Details of your environment, including:

  • Tableau Server version: Tableau Online
  • Python version: 3.8.10
  • TSC library version: 0.19.0 (via tabcmd v2.0.6)

To Reproduce This cannot be reproduced deterministically and looks like a server bug.

Results 400080: Bad Request There was a problem querying the pdf for view "<UUID>"

septatrix avatar Nov 23 '22 17:11 septatrix

Should there any other information I could contribute to help troubleshooting (like the timestamp when this happened etc.) I will try my best to provide it.

septatrix avatar Nov 29 '22 21:11 septatrix

Hi - sorry for the long delay, but I haven't yet figured this one out. If you are able to repro this again and give me a timestamp, that would be very helpful thanks!

jacalata avatar Dec 13 '22 18:12 jacalata

Depending on how long you store your logs, one occurence I was able to find in our logs was from 2022-11-23T18:37:18.377108+0100. Also another exception I was able to find in our logs which I did not notice before is tableauserverclient.server.endpoint.exceptions.InternalServerError: Error status code: 504 b'', last occurence: 2022-12-07T18:01:54.477178+0100.

These usually surface during a weekly cron job with the next run due tomorrow, so maybe I can get you a more recent event then.

septatrix avatar Dec 13 '22 18:12 septatrix

Hi @jacalata, yesterday I got one of both. I pasted the full traceback below, starting from the first point inside the library so you can get an idea which REST calls might have caused this. If you want I can also give you the UUID for the view.

2022-12-14T18:29:28.862415+0100 python[2702058]:   File "/opt/tableau-report-distribution/.venv/lib/python3.8/site-packages/tableauserverclient/models/view_item.py", line 94, in pdf
2022-12-14T18:29:28.862415+0100 python[2702058]:     return self._pdf()
2022-12-14T18:29:28.862415+0100 python[2702058]:   File "/opt/tableau-report-distribution/.venv/lib/python3.8/site-packages/tableauserverclient/server/endpoint/views_endpoint.py", line 99, in pdf_fetcher
2022-12-14T18:29:28.862415+0100 python[2702058]:     return self._get_view_pdf(view_item, req_options)
2022-12-14T18:29:28.862415+0100 python[2702058]:   File "/opt/tableau-report-distribution/.venv/lib/python3.8/site-packages/tableauserverclient/server/endpoint/views_endpoint.py", line 106, in _get_view_pdf
2022-12-14T18:29:28.862415+0100 python[2702058]:     server_response = self.get_request(url, req_options)
2022-12-14T18:29:28.862415+0100 python[2702058]:   File "/opt/tableau-report-distribution/.venv/lib/python3.8/site-packages/tableauserverclient/server/endpoint/endpoint.py", line 121, in get_request
2022-12-14T18:29:28.862415+0100 python[2702058]:     return self._make_request(
2022-12-14T18:29:28.862415+0100 python[2702058]:   File "/opt/tableau-report-distribution/.venv/lib/python3.8/site-packages/tableauserverclient/server/endpoint/endpoint.py", line 66, in _make_request
2022-12-14T18:29:28.862415+0100 python[2702058]:     self._check_status(server_response)
2022-12-14T18:29:28.862415+0100 python[2702058]:   File "/opt/tableau-report-distribution/.venv/lib/python3.8/site-packages/tableauserverclient/server/endpoint/endpoint.py", line 82, in _check_status
2022-12-14T18:29:28.862415+0100 python[2702058]:     raise ServerResponseError.from_response(server_response.content, self.parent_srv.namespace)
2022-12-14T18:29:28.862415+0100 python[2702058]: tableauserverclient.server.endpoint.exceptions.ServerResponseError:
2022-12-14T18:29:28.862415+0100 python[2702058]:         400080: Bad Request
2022-12-14T18:29:28.862415+0100 python[2702058]:                 There was a problem querying the pdf for view '<UUID>'.
2022-12-14T18:01:56.138455+0100 python[2702058]:   File "/opt/tableau-report-distribution/.venv/lib/python3.8/site-packages/tableauserverclient/models/view_item.py", line 94, in pdf
2022-12-14T18:01:56.138455+0100 python[2702058]:     return self._pdf()
2022-12-14T18:01:56.138455+0100 python[2702058]:   File "/opt/tableau-report-distribution/.venv/lib/python3.8/site-packages/tableauserverclient/server/endpoint/views_endpoint.py", line 99, in pdf_fetcher
2022-12-14T18:01:56.138455+0100 python[2702058]:     return self._get_view_pdf(view_item, req_options)
2022-12-14T18:01:56.138455+0100 python[2702058]:   File "/opt/tableau-report-distribution/.venv/lib/python3.8/site-packages/tableauserverclient/server/endpoint/views_endpoint.py", line 106, in _get_view_pdf
2022-12-14T18:01:56.138455+0100 python[2702058]:     server_response = self.get_request(url, req_options)
2022-12-14T18:01:56.138455+0100 python[2702058]:   File "/opt/tableau-report-distribution/.venv/lib/python3.8/site-packages/tableauserverclient/server/endpoint/endpoint.py", line 121, in get_request
2022-12-14T18:01:56.138455+0100 python[2702058]:     return self._make_request(
2022-12-14T18:01:56.138455+0100 python[2702058]:   File "/opt/tableau-report-distribution/.venv/lib/python3.8/site-packages/tableauserverclient/server/endpoint/endpoint.py", line 66, in _make_request
2022-12-14T18:01:56.138455+0100 python[2702058]:     self._check_status(server_response)
2022-12-14T18:01:56.138455+0100 python[2702058]:   File "/opt/tableau-report-distribution/.venv/lib/python3.8/site-packages/tableauserverclient/server/endpoint/endpoint.py", line 78, in _check_status
2022-12-14T18:01:56.138455+0100 python[2702058]:     raise InternalServerError(server_response)
2022-12-14T18:01:56.138455+0100 python[2702058]: tableauserverclient.server.endpoint.exceptions.InternalServerError:
2022-12-14T18:01:56.138455+0100 python[2702058]: Error status code: 504
2022-12-14T18:01:56.138455+0100 python[2702058]: b''

septatrix avatar Dec 15 '22 15:12 septatrix

I have found this and it is somehow getting caused in the generation of the pdf, definitely a server side issue. I've created an internal bug (#1491387) and will try to get that to the right team.

The 504 bug is a "Gateway Timeout" error. I couldn't actually see it in our logs, so it might be caused by something on your network, or between you and Tableau Online.

jacalata avatar Dec 19 '22 08:12 jacalata

Regarding the 504 I am not sure that this is something between my network and Tableau Online as we seem to successfully receive the HTTP status code (which is 504) so this seems more like a problem between some reverse proxy or load-balancer exposed by Tableau and the corresponding backend services. This suspicion is also supported by the fact that some errors are 502 with a complete body of <html><body><h1>502 Bad Gateway</h1>\nThe server returned an invalid or incomplete response.\n</body></html>\n\n. So the transmission itself does not fail and our network does not have any proxy which could cause such a behaviour (especially considering that its HTTPS).

septatrix avatar Mar 01 '23 20:03 septatrix