AxiosError: write EPROTO C0D7BC0EAE7F0000

huangapple go评论135阅读模式
英文:

AxiosError: write EPROTO C0D7BC0EAE7F0000

问题

我在尝试向端点发送POST请求时遇到了这个错误。我不知道该怎么办,实际上也找不到关于它的任何信息。你能帮助我吗?非常感谢!

以下是我的axios请求的样子:

  1. const config = {
  2. headers: {
  3. accept: "*/*",
  4. "accept-language": "tr,en-US;q=0.9,en;q=0.8",
  5. "cache-control": "no-cache",
  6. "content-type": "application/x-www-form-urlencoded;charset=UTF-8",
  7. pragma: "no-cache",
  8. "sec-fetch-mode": "cors",
  9. "sec-fetch-site": "same-origin",
  10. },
  11. };
  12. const url =
  13. process.env.MODE === "TEST"
  14. ? "https://earsivportaltest.efatura.gov.tr/earsiv-services/assos-login"
  15. : "https://earsivportal.efatura.gov.tr/earsiv-services/assos-login";
  16. const assoscmd = process.env.MODE === "TEST" ? "login" : "anologin";
  17. const response = await axios.post(
  18. `${url}`,
  19. {
  20. assoscmd: assoscmd,
  21. userid: userId,
  22. sifre: password,
  23. sifre2: password,
  24. parola: 1,
  25. },
  26. config
  27. );
  28. return response.data;

以下是我的错误:

  1. AxiosError: write EPROTO C0D7BC0EAE7F0000:error:0A000152:SSL routines:final_renegotiate:unsafe legacy renegotiation disabled:../deps/openssl/openssl/ssl/statem/extensions.c:922:
  2. at AxiosError.from (/mnt/D/Yedekler/30 Aralık/Belgeler/fatura/node_modules/axios/dist/node/axios.cjs:789:14)
  3. at RedirectableRequest.handleRequestError (/mnt/D/Yedekler/30 Aralık/Belgeler/fatura/node_modules/axios/dist/node/axios.cjs:2744:25)
  4. at RedirectableRequest.emit (node:events:513:28)
  5. at eventHandlers.<computed> (/mnt/D/Yedekler/30 Aralık/Belgeler/fatura/node_modules/follow-redirects/index.js:14:24)
  6. at ClientRequest.emit (node:events:513:28)
  7. at TLSSocket.socketErrorListener (node:_http_client:494:9)
  8. at TLSSocket.emit (node:events:513:28)
  9. at emitErrorNT (node:internal/streams/destroy:151:8)
  10. at emitErrorCloseNT (node:internal/streams/destroy:116:3)
  11. at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  12. syscall: 'write',
  13. code: 'EPROTO',
  14. errno: -71,
  15. }
英文:

I'm getting this error while trying send a post request to an endpoint. I don't know what to do and actually couldn't find anything about it. Could you please help me? Thanks a lot!

Here is how my axios request looks like:

  1. const config = {
  2. headers: {
  3. accept: "*/*",
  4. "accept-language": "tr,en-US;q=0.9,en;q=0.8",
  5. "cache-control": "no-cache",
  6. "content-type": "application/x-www-form-urlencoded;charset=UTF-8",
  7. pragma: "no-cache",
  8. "sec-fetch-mode": "cors",
  9. "sec-fetch-site": "same-origin",
  10. },
  11. };
  12. const url =
  13. process.env.MODE === "TEST"
  14. ? "https://earsivportaltest.efatura.gov.tr/earsiv-services/assos-login"
  15. : "https://earsivportal.efatura.gov.tr/earsiv-services/assos-login";
  16. const assoscmd = process.env.MODE === "TEST" ? "login" : "anologin";
  17. const response = await axios.post(
  18. `${url}`,
  19. {
  20. assoscmd: assoscmd,
  21. userid: userId,
  22. sifre: password,
  23. sifre2: password,
  24. parola: 1,
  25. },
  26. config
  27. );
  28. return response.data;

Here is my error:

  1. AxiosError: write EPROTO C0D7BC0EAE7F0000:error:0A000152:SSL routines:final_renegotiate:unsafe legacy renegotiation disabled:../deps/openssl/openssl/ssl/statem/extensions.c:922:
  2. at AxiosError.from (/mnt/D/Yedekler/30 Aralık/Belgeler/fatura/node_modules/axios/dist/node/axios.cjs:789:14)
  3. at RedirectableRequest.handleRequestError (/mnt/D/Yedekler/30 Aralık/Belgeler/fatura/node_modules/axios/dist/node/axios.cjs:2744:25)
  4. at RedirectableRequest.emit (node:events:513:28)
  5. at eventHandlers.<computed> (/mnt/D/Yedekler/30 Aralık/Belgeler/fatura/node_modules/follow-redirects/index.js:14:24)
  6. at ClientRequest.emit (node:events:513:28)
  7. at TLSSocket.socketErrorListener (node:_http_client:494:9)
  8. at TLSSocket.emit (node:events:513:28)
  9. at emitErrorNT (node:internal/streams/destroy:151:8)
  10. at emitErrorCloseNT (node:internal/streams/destroy:116:3)
  11. at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  12. syscall: 'write',
  13. code: 'EPROTO',
  14. errno: -71,

答案1

得分: 3

对于一个旧问题的回答,但如果有人有类似的问题,可以稍微修改这里的答案来解决它。

需要添加以下内容:

  1. const https = require('https');
  2. const crypto = require('node:crypto');

然后像这样在配置中添加:

  1. httpsAgent: new https.Agent({secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT})

或者

  1. httpsAgent: new https.Agent({secureOptions: crypto.constants.SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION}),

像这样修改你的配置:

  1. const config = {
  2. headers: {
  3. ...
  4. },
  5. httpsAgent: new https.Agent({secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT}),
  6. };

这将解决final_renegotiate:unsafe legacy renegotiation disabled:问题。了解更多关于node:crypto模块的OpenSSL选项,或者其他选项的SSL_OP_Flags

英文:

Replying to an old question, but if anyone has a similar problem it can be solved modifying the answer here slightly.

require the following :

  1. const https = require('https');
  2. const crypto = require('node:crypto');

then add

  1. httpsAgent: new https.Agent({secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT})

or

  1. httpsAgent: new https.Agent({secureOptions: crypto.constants.SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION}),

to your config like this :

  1. const config = {
  2. headers: {
  3. ...
  4. },
  5. httpsAgent: new https.Agent({secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT}),
  6. };

This will solve the final_renegotiate:unsafe legacy renegotiation disabled:. issue. Read more about OpenSSL options of the node:crypto module, or SSL_OP_FLags for other options.

huangapple
  • 本文由 发表于 2023年1月6日 19:23:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/75030316.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定