Hello, is the PDF export api currently facing issu...
# gooddata-cloud
Hello, is the PDF export api currently facing issues? We are trying to export a pdf of a very simple dashboard (4 insights, ~200 rows of data read) and it already failed more than 5 times since ~6h (while more complex exports succeeded). We are used to this api being very flaky so we do retry the exports, we try not to export too big dahsboards and we also sometimes visit them in the browser beforehand for the cache to be hot but here, nothing seems to help. I can share the workspace and dashboard privately. Thanks
Hello Simon, could you please provide the error you are getting? Please also feel free to reach out to me via PM with the workspace info.
Please let me send over here our findings for future reference. It seems that the wrong headers were being passed in the call. Instead of:
Copy code
headers: {
            "Content-Type": "application/json",
            Accept: "application/json",
            Authorization: `Bearer ${process.env.GOODDATA_TOKEN}`,
You need to use:
Copy code
-H "Content-Type: application/vnd.gooddata.api+json" \
  -H "Accept: application/vnd.gooddata.api+json" \
  -H "Authorization: Bearer <API_TOKEN>" \
Feel free to confirm the issue is solved.
Thanks for tracking this with me. By using those headers, the
endpoint is returning me a 400 error and thus doesn't start the export. I'm not sure where is the issue at my end, still investigating. I'm doing a
request and the body is well sent as JSON, which matches the documentation.
so this is the error i'm getting following the headers:
Copy code
  "detail": "Request Content-Type header '[application/vnd.gooddata.api+json]' does not match any allowed types. Must be one of: [application/json]., Request Accept header '[application/vnd.gooddata.api+json]' does not match any defined response types. Must be one of: [application/json].",
  "status": 400,
  "title": "Bad Request",
  "traceId": "74f6767160b17c767ce4654267c663bf"
(it is probably why i changed them to
in my code, but i can't confirm that since it's been weeks)
I see the following error on our end:
Copy code
The API request contained invalid value in its query params, headers or the payload. [original error: com.gooddata.tiger.oapi.validator.exception.InvalidPayloadException]
Could you please confirm the body request is correct? Could you also test the API call via an API client and make sure it is correct?
I copy-pasted the curl example at https://www.gooddata.com/docs/cloud/create-dashboards/export/ under (api/bash):
Copy code
curl $HOST_URL/api/v1/actions/workspaces/$WORKSPACE_ID/export/visual \
  -H "Content-Type: application/vnd.gooddata.api+json" \
  -H "Accept: application/vnd.gooddata.api+json" \
  -H "Authorization: Bearer <API_TOKEN>" \
  -X POST \
  -d '{
      "fileName": "<export_filename>",
      "dashboardId": "<dashboard_id>"
  }' | jq .
i replaced the dashboardId. workspaceId and api_token with my values, still the same error. curl 8.4.0 and on macos
So i restored the previous version (with the wrong headers), tried again and finally the export passed. I'm not sure if you're seeing something relevant in your logs (for instance at 2024-02-12T160358.479000091Z) I probably tried that export close to 10 times today. I feel the issue is not at my end but at GoodData's: the export to pdf api is flaky. We are using it since it release because the feature is great but it's not reliable, even if we are taking the most care we can to not overload GoodData's system (by adding random waits between call, retry twice the failed ones, etc).