使用 jssdk 打开文档时提示 errno : 15055,reason : "DownloadFailed"

Viewed 172

请求详情:

     "request": {
          "method": "POST",
          "url": "https://o.wpsgo.com/api/v3/office/file/961f65c9f12749e49fe66c55c83f7c5d/open/word",
          "httpVersion": "http/2.0",
          "headers": [
            {
              "name": ":authority",
              "value": "o.wpsgo.com"
            },
            {
              "name": ":method",
              "value": "POST"
            },
            {
              "name": ":path",
              "value": "/api/v3/office/file/961f65c9f12749e49fe66c55c83f7c5d/open/word"
            },
            {
              "name": ":scheme",
              "value": "https"
            },
            {
              "name": "accept",
              "value": "*/*"
            },
            {
              "name": "accept-encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "accept-language",
              "value": "zh-CN,zh;q=0.9,en;q=0.8"
            },
            {
              "name": "content-length",
              "value": "256"
            },
            {
              "name": "content-type",
              "value": "text/plain;charset=UTF-8"
            },
            {
              "name": "cookie",
              "value": "SX20230626WDOUIE_token=1"
            },
            {
              "name": "dnt",
              "value": "1"
            },
            {
              "name": "origin",
              "value": "https://o.wpsgo.com"
            },
            {
              "name": "referer",
              "value": "https://o.wpsgo.com/office/w/961f65c9f12749e49fe66c55c83f7c5d?_w_appid=SX20230626WDOUIE&_w_tokentype=1"
            },
            {
              "name": "sec-ch-ua",
              "value": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\""
            },
            {
              "name": "sec-ch-ua-mobile",
              "value": "?0"
            },
            {
              "name": "sec-ch-ua-platform",
              "value": "\"Windows\""
            },
            {
              "name": "sec-fetch-dest",
              "value": "empty"
            },
            {
              "name": "sec-fetch-mode",
              "value": "cors"
            },
            {
              "name": "sec-fetch-site",
              "value": "same-origin"
            },
            {
              "name": "user-agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
            },
            {
              "name": "x-app-id",
              "value": "SX20230626WDOUIE"
            },
            {
              "name": "x-csrf-rand",
              "value": "XtA4+DyRkubGs2lqWYFAos9L2lE332hIb9bkHyfwz9PQvorriwbCI1rG0kMHsJfawtB8/A78PyV4Nw5AeBNBs9RboMtn5QlxEemkOI0tkUIvlMW1WbWdvApDf4zFarCH4/4wnoOhQ8GluVN6mlRf2t0mQL4v"
            },
            {
              "name": "x-user-query",
              "value": "_w_appid=SX20230626WDOUIE&_w_tokentype=1"
            },
            {
              "name": "x-user-token",
              "value": "1"
            }
          ],
          "queryString": [],
          "cookies": [
            {
              "name": "SX20230626WDOUIE_token",
              "value": "1",
              "path": "/",
              "domain": ".o.wpsgo.com",
              "expires": "2023-06-28T09:26:51.000Z",
              "httpOnly": false,
              "secure": true,
              "sameSite": "None"
            }
          ],
          "headersSize": -1,
          "bodySize": 256,
          "postData": {
            "mimeType": "text/plain;charset=UTF-8",
            "text": "{\"connid\":\"6a7fbf32b81a3a342760e271b8dcb9b1\",\"args\":{\"password\":\"\",\"readonly\":false,\"modifyPassword\":\"\",\"sync\":true,\"startVersion\":0,\"endVersion\":0},\"ex_args\":{\"queryInitArgs\":{}},\"group\":\"20230419213749-36baf9ff1e\",\"front_ver\":\"20230324121601-fb1762365c\"}"
          }
        },
        "response": {
          "status": 500,
          "statusText": "",
          "httpVersion": "http/2.0",
          "headers": [
            {
              "name": "access-control-allow-credentials",
              "value": "true"
            },
            {
              "name": "access-control-allow-headers",
              "value": "accept, content-type, x-user-query, x-device-id, x-requested-with, x-csrftoken, accept-encoding, accept-language, x-csrf-rand, x-server-id, x-endpoint-id, x-app-id, EagleEye-TraceID, EagleEye-SessionID, EagleEye-pAppName, x-user-token, x-app-id, x-app-token"
            },
            {
              "name": "access-control-allow-methods",
              "value": "GET, POST, PUT, DELETE, OPTIONS"
            },
            {
              "name": "access-control-allow-origin",
              "value": "https://o.wpsgo.com"
            },
            {
              "name": "access-control-expose-headers",
              "value": "accept, content-type, x-user-query, x-device-id, x-requested-with, x-csrftoken, accept-encoding, accept-language, x-csrf-rand, x-server-id, x-endpoint-id, x-app-id, EagleEye-TraceID, EagleEye-SessionID, EagleEye-pAppName, x-user-token, x-app-id, x-app-token"
            },
            {
              "name": "content-length",
              "value": "62"
            },
            {
              "name": "content-type",
              "value": "application/json; charset=utf-8"
            },
            {
              "name": "date",
              "value": "Tue, 27 Jun 2023 09:28:09 GMT"
            },
            {
              "name": "server",
              "value": "elb"
            },
            {
              "name": "x-group",
              "value": "green"
            },
            {
              "name": "x-klb",
              "value": "2"
            },
            {
              "name": "x-region",
              "value": "wq"
            },
            {
              "name": "x-request-id",
              "value": "0cc4701c279543327627b3e1cdc61527"
            }
          ],
          "cookies": [],
          "content": {
            "size": 62,
            "mimeType": "application/json"
          },
          "redirectURL": "",
          "headersSize": -1,
          "bodySize": -1,
          "_transferSize": 763,
          "_error": null
        },

返回值:

{"errno":15055,"msg":"","reason":"","result":"DownloadFailed"}

image.png


后端服务使用的是 https://gitee.com/wpsweboffice/weboffice-provider-demo-java 示例,输出的日志显示请求成功:

2023-06-27 17:34:49.307 DEBUG 26308 --- [nio-8888-exec-5] o.s.web.servlet.DispatcherServlet        : GET "/download/961f65c9f12749e49fe66c55c83f7c5d/1", parameters={}
2023-06-27 17:34:49.307 DEBUG 26308 --- [nio-8888-exec-5] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to cn.wps.solution.demo.controller.ConsoleController#download(String, int)
2023-06-27 17:34:49.308 DEBUG 26308 --- [nio-8888-exec-5] m.m.a.RequestResponseBodyMethodProcessor : Using 'application/octet-stream', given [*/*] and supported [application/octet-stream]
2023-06-27 17:34:49.328 DEBUG 26308 --- [nio-8888-exec-5] m.m.a.RequestResponseBodyMethodProcessor : Writing [{-48, -49, 17, -32, -95, -79, 26, -31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 3, 0,  (truncated)...]
2023-06-27 17:34:49.329 DEBUG 26308 --- [nio-8888-exec-5] o.s.web.servlet.DispatcherServlet        : Completed 200 OK

请问怎么排查问题?

1 Answers

解决了, /v3/3rd/files/${file_id}/download 接口里面要返回正确的 digest 值