运维中心 /getJsErrDetail # operation.getJsErrDetail > 本接口应在服务器端调用,详细说明参见[服务端API](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/backend-api.html)。 > 本接口支持[云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)。需开发者工具版本 >= `1.02.1904090`(最新[稳定版下载](https://developers.weixin.qq.com/miniprogram/dev/devtools/stable.html)),`wx-server-sdk` >= `0.4.0` 错误查询详情 调用方式: - [HTTPS 调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/operation/operation.getJsErrDetail.html#method-http) - [云调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/operation/operation.getJsErrDetail.html#method-cloud) ## HTTPS 调用 ### 请求地址 ```text POST https://api.weixin.qq.com/wxaapi/log/jserr_detail?access_token=ACCESS_TOKEN ``` ### 请求参数 | 属性 | 类型 | 默认值 | 必填 | 说明 | | :------------------------------------ | :----- | :----- | :--- | :----------------------------------------------------------- | | access_token / cloudbase_access_token | string | | 是 | [接口调用凭证](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html) | | startTime | string | | 是 | 开始时间, 格式 "xxxx-xx-xx" | | endTime | string | | 是 | 结束时间,格式 “xxxx-xx-xx” | | errorMsgMd5 | string | | 是 | [错误列表查询](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/operation/operation.getJsErrList.html) 接口 返回的 errorMsgMd5 字段 | | errorStackMd5 | string | | 是 | [错误列表查询](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/operation/operation.getJsErrList.html) 接口 返回的 errorStackMd5 字段 | | appVersion | string | | 是 | 小程序版本 "0"代表全部, 例如:“2.0.18” | | sdkVersion | string | | 是 | 基础库版本 "0"表示所有版本,例如 "2.14.1" | | osName | string | | 是 | 系统类型 "0"【全部】,"1" 【安卓】,"2" 【IOS】,"3"【其他】 | | clientVersion | string | | 是 | 客户端版本 "0"表示所有版本, 例如 "7.0.22" | | openid | string | | 是 | 发生错误的用户 openId | | desc | string | | 是 | 排序规则 "0" 升序, "1" 降序 | | offset | number | | 是 | 分页起始值 | | limit | number | | 是 | 一次拉取最大值 | ### 请求示例 请在 HTTP RequestHeader 中 设置如下字段:content-type: application/json; ```json { "startTime": "2021-01-25", "endTime": "2021-01-26", "errorMsgMd5": "f2fb4f8cd638466ad0e7607b01b7d0ca", "errorStackMd5": "795a63b70ce5755c7103611d93077603", "appVersion": "0", "sdkVersion": "0", "osName": "2", "clientVersion": "0", "openid": "", "offset": 0, "limit": 10, "desc": "0" } ``` ### 返回的 JSON 数据包 | 属性 | 类型 | 说明 | | :--------- | :------------- | :------- | | errcode | number | 错误码 | | errmsg | string | 错误信息 | | data | Array.<Object> | 错误列表 | | totalCount | number | 总条数 | ### 响应示例 ```json { "success": true, "openid": "", "data": [ { "Count": "1", "sdkVersion": "2.14.1", "ClientVersion": "7.0.21", "errorStackMd5": "e371cd9cae821969c855f9f461327dac", "TimeStamp": "2021-01-25 16:36:39", "appVersion": "2.6.16", "errorMsgMd5": "53b4825ec4a41d966f88c298c718de80", "errorMsg": "errCode: -404012 polling exceed max timeout retry | errMsg: cloud.callFunction:fail polling exceed max timeout retry (callId: 1611553677669-0.2531087324274228) (trace: 13:47:57 start->13:48:12 timeout, retry->13:48:18 app hide->13:48:27 timeout, retry->13:48:42 timeout, abort); at cloud.callFunction api; ", "errorStack": "Error: errCode: -404012 polling exceed max timeout retry | errMsg: cloud.callFunction:fail polling exceed max timeout retry (callId: 1611553677669-0.2531087324274228) (trace: 13:47:57 start->13:48:12 timeout, retry->13:48:18 app hide->13:48:27 timeout, retry->13:48:42 timeout, abort); at cloud.callFunction api; \n at new t (https://usr/app-service.js:2:320930)\n at c (https://usr/app-service.js:2:321660)\n at l (https://usr/app-service.js:2:321755)\n at https://usr/app-service.js:2:297192\n at https://usr/app-service.js:2:76398\n at Object.next (https://usr/app-service.js:2:76503)\n at s (https://usr/app-service.js:2:75234)", "Ds": "2021-01-25", "OsName": "1", "openId": "o-0YS0ZNM_bzkm13NKNUSwbrEkYU", "pluginversion": "0", "appId": "wxcff7381e631cf54e", "DeviceModel": "Redmi Note 5Aarm64-v8a", "source": "", "route": "", "Uin": "", "nickname": "" } ], "totalCount": 1, "errcode": 0 } ``` ## 云调用 > [云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)是微信云开发提供的在云函数中调用微信开放接口的能力,需要在云函数中通过 `wx-server-sdk` 使用。 ### 接口方法 ```js openapi.operation.getJsErrDetail ``` > 需在 `config.json` 中配置 `operation.getJsErrDetail` API 的权限,[详情](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html#usage-3) ### 请求参数 | 属性 | 类型 | 默认值 | 必填 | 说明 | | :------------ | :----- | :----- | :--- | :----------------------------------------------------------- | | startTime | string | | 是 | 开始时间, 格式 "xxxx-xx-xx" | | endTime | string | | 是 | 结束时间,格式 “xxxx-xx-xx” | | errorMsgMd5 | string | | 是 | [错误列表查询](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/operation/operation.getJsErrList.html) 接口 返回的 errorMsgMd5 字段 | | errorStackMd5 | string | | 是 | [错误列表查询](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/operation/operation.getJsErrList.html) 接口 返回的 errorStackMd5 字段 | | appVersion | string | | 是 | 小程序版本 "0"代表全部, 例如:“2.0.18” | | sdkVersion | string | | 是 | 基础库版本 "0"表示所有版本,例如 "2.14.1" | | osName | string | | 是 | 系统类型 "0"【全部】,"1" 【安卓】,"2" 【IOS】,"3"【其他】 | | clientVersion | string | | 是 | 客户端版本 "0"表示所有版本, 例如 "7.0.22" | | openid | string | | 是 | 发生错误的用户 openId | | desc | string | | 是 | 排序规则 "0" 升序, "1" 降序 | | offset | number | | 是 | 分页起始值 | | limit | number | | 是 | 一次拉取最大值 | ### 请求示例 请在 HTTP RequestHeader 中 设置如下字段:content-type: application/json; ```js const cloud = require('wx-server-sdk') cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV, }) exports.main = async (event, context) => { try { const result = await cloud.openapi.operation.getJsErrDetail({ "startTime": '2021-01-25', "endTime": '2021-01-26', "errorMsgMd5": 'f2fb4f8cd638466ad0e7607b01b7d0ca', "errorStackMd5": '795a63b70ce5755c7103611d93077603', "appVersion": '0', "sdkVersion": '0', "osName": '2', "clientVersion": '0', "openid": '', "offset": 0, "limit": 10, "desc": '0' }) return result } catch (err) { return err } } ``` ### 响应示例 ```json const cloud = require('wx-server-sdk') cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV, }) exports.main = async (event, context) => { try { const result = await cloud.openapi.operation.getJsErrDetail({ "success": true, "openid": '', "data": [ { "Count": '1', "sdkVersion": '2.14.1', "ClientVersion": '7.0.21', "errorStackMd5": 'e371cd9cae821969c855f9f461327dac', "TimeStamp": '2021-01-25 16:36:39', "appVersion": '2.6.16', "errorMsgMd5": '53b4825ec4a41d966f88c298c718de80', "errorMsg": 'errCode: -404012 polling exceed max timeout retry | errMsg: cloud.callFunction:fail polling exceed max timeout retry (callId: 1611553677669-0.2531087324274228) (trace: 13:47:57 start->13:48:12 timeout, retry->13:48:18 app hide->13:48:27 timeout, retry->13:48:42 timeout, abort); at cloud.callFunction api; ', "errorStack": 'Error: errCode: -404012 polling exceed max timeout retry | errMsg: cloud.callFunction:fail polling exceed max timeout retry (callId: 1611553677669-0.2531087324274228) (trace: 13:47:57 start->13:48:12 timeout, retry->13:48:18 app hide->13:48:27 timeout, retry->13:48:42 timeout, abort); at cloud.callFunction api; \n at new t (https://usr/app-service.js:2:320930)\n at c (https://usr/app-service.js:2:321660)\n at l (https://usr/app-service.js:2:321755)\n at https://usr/app-service.js:2:297192\n at https://usr/app-service.js:2:76398\n at Object.next (https://usr/app-service.js:2:76503)\n at s (https://usr/app-service.js:2:75234)', "Ds": '2021-01-25', "OsName": '1', "openId": 'o-0YS0ZNM_bzkm13NKNUSwbrEkYU', "pluginversion": '0', "appId": 'wxcff7381e631cf54e', "DeviceModel": 'Redmi Note 5Aarm64-v8a', "source": '', "route": '', "Uin": '', "nickname": '' } ], "totalCount": 1, "errcode": 0 }) return result } catch (err) { return err } } ```