Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

middleware[response] catch error Error: self signed certificate #9

Open
zhongs opened this issue Mar 4, 2020 · 0 comments
Open

middleware[response] catch error Error: self signed certificate #9

zhongs opened this issue Mar 4, 2020 · 0 comments
Labels
egg egg框架相关问题

Comments

@zhongs
Copy link
Owner

zhongs commented Mar 4, 2020

egg 后台调用 https 报错 ,代码中加入这段代码可以解决

 process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
middleware[response] catch error Error: self signed certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1473:34)
    at TLSSocket.emit (events.js:321:20)
    at TLSSocket._finishInit (_tls_wrap.js:916:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:686:12) {
  code: 'DEPTH_ZERO_SELF_SIGNED_CERT',
  name: 'ResponseError',
  data: undefined,
  path: '/clientApi/user/info',
  status: -1,
  headers: {},
  res: {
    status: -1,
    statusCode: -1,
    statusMessage: null,
    headers: {},
    size: 0,
    aborted: false,
    rt: 174,
    keepAliveSocket: false,
    data: undefined,
    requestUrls: [ 'https://135.175.161.188/clientApi/user/info' ],
    timing: null,
    remoteAddress: '135.175.161.188',
    remotePort: 443,
    socketHandledRequests: 1,
    socketHandledResponses: 0
  }
}
2020-03-04 20:43:39,430 ERROR 19452 [-/127.0.0.1/-/225ms GET /api/cvts] nodejs.ResponseError: self signed certificate, POST https://135.175.161.188/clientApi/user/info -1 (connected: true, keepalive socket: false, agent status: {"createSocketCount":1,"createSocketErrorCount":0,"closeSocketCount":0,"errorSocketCount":1,"timeoutSocketCount":0,"requestCount":0,"freeSockets":{},"sockets":{"135.175.161.188:443::::::::::::::::::":1},"requests":{}}, socketHandledRequests: 1, socketHandledResponses: 0)
headers: {}
    at TLSSocket.onConnectSecure (_tls_wrap.js:1473:34)
    at TLSSocket.emit (events.js:321:20)
    at TLSSocket._finishInit (_tls_wrap.js:916:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:686:12)
code: "DEPTH_ZERO_SELF_SIGNED_CERT"
name: "ResponseError"
data: undefined
path: "/clientApi/user/info"
status: -1
headers: {}
res: {"status":-1,"statusCode":-1,"statusMessage":null,"headers":{},"size":0,"aborted":false,"rt":174,"keepAliveSocket":false,"requestUrls":["https://135.175.161.188/clientApi/user/info"],"timing":null,"remoteAddress":"134.175.161.188","remotePort":443,"socketHandledRequests":1,"socketHandledResponses":0}
pid: 19452
hostname: LAPTOP-64O3I7FE
@zhongs zhongs added the egg egg框架相关问题 label Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
egg egg框架相关问题
Projects
None yet
Development

No branches or pull requests

1 participant