[最终更新] 根据此线程修复:https://github.com/docusign/docusign-esign-node-client/issues/295
显然与 DocuSign 的 API 的安全添加相关。
今天之前我还没有遇到过这个问题。上周我向客户提供了一个演示,相同的代码运行良好。今天我得到以下信息:
{
    "status": 444,
    "response": {
        "req": {
            "method": "GET",
            "url": "https://demo.docusign.net/restapi...",
            "data": {},
            "headers": {
                "user-agent": "node-superagent/3.8.2",
                "x-docusign-sdk": "Node",
                "authorization": "Bearer ABC...",
                "content-type": "application/json",
                "accept": "application/json"
            }
        },
        "header": {
            "content-type": "text/html",
            "x-docusign-tracetoken": "2eeb8caa-8865-4898-bef9-d3611bfaa3f7",
            "x-docusign-node": "DA2DFE5",
            "date": "Fri, 17 Jun 2022 01:02:02 GMT",
            "content-length": "54",
            "connection": "close",
            "strict-transport-security": "max-age=31536000; includeSubDomains"
        },
        "status": 444,
        "text": "The custom error module does not recognize this error."
    }
}
通过节点 SDK,我使用 获取令牌requestJWTUserToken,并设置 apiclient 的 auth 标头,然后新建一个 EnvelopesAPI 实例。当我致电getEnvelope()或listStatusChanges()时,我收到上述错误。这些代码在几个月内都没有发生任何变化,而且我使用相同的集成密钥、帐户、私钥,一切。我已经演示过几次了 - 没有问题。
一个有趣的观察:上面的错误给了我一个 URL 和令牌。该令牌是有效的,如果我envelopes使用该令牌通过 Postman 向 URL(端点)发出请求,则请求会成功。所以我通过 SDK 的调用似乎由于某种原因失败了。
我似乎无法破解这个问题,而且现在我无法绕过它,因为有几个上周才工作的演示系统。
我正在使用 docusign-esign 5.17 模块 - 从 5.15 升级,试图解决该问题。没有运气。
这个错误从何而来?
我正在运行我的节点应用程序,该应用程序通过 DocuSign Node SDK 针对代理发出请求,以便我可以看到失败的请求实际上是什么样子:
他们以同样的方式失败。
HTTP/1.1 444 
Content-Type: text/html
X-DocuSign-TraceToken: 338534c6-c8c3-4b01-9b66-35d697cd0053
X-DocuSign-Node: DA1DFE4
Date: Fri, 17 Jun 2022 03:55:07 GMT
Content-Length: 54
Vary: Accept-Encoding
Connection: close
Strict-Transport-Security: max-age=31536000; includeSubDomains
The custom error module does not recognize this error.
我使用 Proxyman 来捕获请求,与 Chrome 或 Firefox 一样,它可以让您将请求复制为 cURL 命令。如果我将失败的请求复制为 cURL,然后在终端运行,它就会成功。
[MacBookPro0020]~/source/docusign/jwt-smoke-test:0 (master)
$ curl 'https://demo.docusign.net/restapi/v2.1/accounts/a0a4c81f-.../envelopes?envelope_ids=e750526f-...&envelope_ids=a38b794b...&envelope_ids=a5d8c586-...' \
-H 'Host: demo.docusign.net' \
-H 'User-Agent: node-superagent/3.8.2' \
-H 'X-DocuSign-SDK: Node' \
-H 'Node-Ver: v14.18.3' \
-H 'Authorization: Bearer ABCD...' \
-H 'Accept: application/json' \
-H 'Connection: close' \
-H 'Content-Type: application/json' \
--proxy http://localhost:9090
{"resultSetSize":"1","startPosition":"0","endPosition":"0","totalSetSize":"1","nextUri":"","previousUri":"","envelopes":[{"status":"created","documentsUri":"/envelopes/d97565c8...purgeState":"unpurged","envelopeIdStamping":"true","autoNavigation":"true","isSignatureProviderEnvelope":"false","allowComments":"true","anySigner":null,"envelopeLocation":"current_site"}]}
我正在使用 JWT 身份验证令牌,因此我再次获得了有效令牌。通过 SDK 的调用始终失败,但通过 Postman 进行 cURL 和手动请求均会成功。
我不知所措。
其他详细信息:我在 MacOS 和 Windows 上看到了同样的问题(即托管 docusign-esign 的节点应用程序)。我正在使用授权代码授予发送信封并查询信封状态,效果很好。直到本周我都没有出现任何问题地使用 JWT Grant(上周刚刚演示了自动化功能并且它起作用了。)我没有对我的 DocuSign 功能进行任何代码更改,我的同事也没有,至少根据存储库的历史。
我不记得以前遇到过上述错误。我很想知道为什么 cURL'ing 相同的请求会成功。我不想放弃 SDK 并提出我自己的请求,但这并不困难。
这是一个简单的重现 - 它是 Node SDK 的 QuickStart 演示项目的快速而肮脏的副本。我只使用 docusign-esign。
精确的。相同的。问题。
同样,我可以将该令牌放入 cURL 或 postman 中,请求就会成功。这里没有太多代码。令牌有效。
async function main() {
    // Data used
    // dsConfig.dsClientId
    // dsConfig.impersonatedUserGuid
    // dsConfig.privateKey
    // dsConfig.dsOauthServer
    let dsConfig = dsConfig_customer; // defined globally
    const jwtLifeSec = 10 * 60, // requested lifetime for the JWT is 10 min
        dsApi = new docusign.ApiClient();
    dsApi.setOAuthBasePath(dsConfig.dsOauthServer.replace('https://', '')); // it should be domain only.
    const results = await dsApi.requestJWTUserToken(dsConfig.dsClientId,
        dsConfig.impersonatedUserGuid, 'signature impersonation', dsConfig.privateKey,
        jwtLifeSec);
    console.log( results.body.access_token );
    const userInfo = await dsApi.getUserInfo(results.body.access_token);
    dsApi.setBasePath(userInfo.accounts[0].baseUri + '/restapi');
    dsApi.addDefaultHeader( 'Authorization', 'Bearer ' + results.body.access_token );
    const envelopesAPI = new docusign.EnvelopesApi(dsApi);
    const res = await envelopesAPI.getEnvelope( dsConfig.accountID, 'e1917111-2900-48e8-9054-799169379c8a', null );
    console.log(res);
    return {
        accessToken: results.body.access_token,
        tokenExpirationTimestamp: expiresAt,
        userInfo,
        account: userInfo.accounts[0]
    };
}
main().then(result => console.log(result)).catch(err=>console.error(err));
...
    header: {
      'content-type': 'text/html',
      'x-docusign-tracetoken': '685b6226-a0d3-4547-94c7-df0216d884a3',
      'x-docusign-node': 'DA2DFE188',
      date: 'Fri, 17 Jun 2022 05:20:12 GMT',
      'content-length': '54',
      vary: 'Accept-Encoding',
      connection: 'close',
      'strict-transport-security': 'max-age=31536000; includeSubDomains'
    },
    statusCode: 444,
    status: 444,
    statusType: 4,
    info: false,
    ok: false,
    redirect: false,
    clientError: true,
    serverError: false,
    error: Error: cannot GET /restapi/v2.1/accounts/49754554-ABCD-.../envelopes/e1917111-2900-48e8-9054-799169379c8a (444)
...
| 归档时间: | 
 | 
| 查看次数: | 462 次 | 
| 最近记录: |