后台微信云托管请求jscode2session接口失败?证书不对
RequestError: Error: self signed certificate at new RequestError (/app/node_modules/request-promise-core/lib/errors.js:14:15) at Request.plumbing.callback (/app/node_modules/request-promise-core/lib/plumbing.js:87:29) at Request.RP$callback [as _callback] (/app/node_modules/request-promise-core/lib/plumbing.js:46:31) at self.callback (/app/node_modules/request/request.js:185:22) at Request.emit (node:events:513:28) at Request.onRequestError (/app/node_modules/request/request.js:877:8) at ClientRequest.emit (node:events:513:28) at TLSSocket.socketErrorListener (node:_http_client:494:9) at TLSSocket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) { cause: Error: self signed certificate at TLSSocket.onConnectSecure (node:_tls_wrap:1539:34) at TLSSocket.emit (node:events:513:28) at TLSSocket._finishInit (node:_tls_wrap:953:8) at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:734:12) { code: 'DEPTH_ZERO_SELF_SIGNED_CERT' }, error: Error: self signed certificate at TLSSocket.onConnectSecure (node:_tls_wrap:1539:34) at TLSSocket.emit (node:events:513:28) at TLSSocket._finishInit (node:_tls_wrap:953:8) at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:734:12) { code: 'DEPTH_ZERO_SELF_SIGNED_CERT' }, options: { method: 'GET', url: 'https://api.weixin.qq.com/sns/jscode2session', qs: { grant_type: 'authorization_code', js_code: '083SJM000yAXZO1L4820091GNN2SJM0F', }, callback: [Function: RP$callback], transform: undefined, simple: true, resolveWithFullResponse: false, transform2xxOnly: false }, response: undefined } <ref *1> { request: <ref *2> { app: Application { _events: [Object: null prototype], _eventsCount: 4, _maxListeners: undefined, proxy: false, middleware: [Array], subdomainOffset: 2, env: 'development', context: [Object], request: {}, response: {}, think: [Object], modules: [Array], models: [Object], services: [Object], logics: [Object], controllers: [Object], routers: [], validators: {}, server: [Server], [Symbol(kCapture)]: false }, req: IncomingMessage { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, socket: [Socket], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, rawHeaders: [Array], rawTrailers: [], aborted: false, upgrade: false, url: '/auth/loginxxxxxxx', method: 'POST', statusCode: null, statusMessage: null, client: [Socket], _consuming: false, _dumped: false, _parsedUrl: [Url], [Symbol(kCapture)]: false, [Symbol(kHeaders)]: [Object], [Symbol(kHeadersCount)]: 52, [Symbol(kTrailers)]: null, [Symbol(kTrailersCount)]: 0, [Symbol(RequestTimeout)]: undefined }, res: ServerResponse { _events: [Object: null prototype], _eventsCount: 3, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: false, chunkedEncoding: false, shouldKeepAlive: true, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: true, sendDate: true, _removedConnection: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: null, _hasBody: true, _trailer: '', finished: false, _headerSent: false, _closed: false, socket: [Socket], _header: null, _keepAliveTimeout: 5000, _onPendingData: [Function: bound updateOutgoingData], req: [IncomingMessage], _sent100: false, _expect_continue: false, _maxRequestsPerSocket: 0, statusCode: 200, __onFinished: [Function], statusMessage: 'OK', [Symbol(kCapture)]: false, [Symbol(kBytesWritten)]: 0, [Symbol(kEndCalled)]: false, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype], [Symbol(kUniqueHeaders)]: null }, ctx: [Circular *1], response: { app: [Application], req: [IncomingMessage], res: [ServerResponse], ctx: [Circular *1], request: [Circular *2], _explicitStatus: true }, originalUrl: '/auth/loginByWeixin', ip: '::ffff:10.13.254.168', accept: Accepts { headers: [Object], negotiator: [Negotiator] }, body: { post: [Object] }, _querycache: { '': [Object: null prototype] {} } }, response: <ref *3> { app: Application { _events: [Object: null prototype], _eventsCount: 4, _maxListeners: undefined, proxy: false, middleware: [Array], subdomainOffset: 2, env: 'development', context: [Object], request: {}, response: {}, think: [Object], modules: [Array], models: [Object], services: [Object], logics: [Object], controllers: [Object], routers: [], validators: {}, server: [Server], [Symbol(kCapture)]: false }, req: IncomingMessage { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, socket: [Socket], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, rawHeaders: [Array], rawTrailers: [], aborted: false, upgrade: false, url: '/auth/loginByWeixin', method: 'POST', statusCode: null, statusMessage: null, client: [Socket], _consuming: false, _dumped: false, _parsedUrl: [Url], [Symbol(kCapture)]: false, [Symbol(kHeaders)]: [Object], [Symbol(kHeadersCount)]: 52, [Symbol(kTrailers)]: null, [Symbol(kTrailersCount)]: 0, [Symbol(RequestTimeout)]: undefined }, res: ServerResponse { _events: [Object: null prototype], _eventsCount: 3, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: false, chunkedEncoding: false, shouldKeepAlive: true, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: true, sendDate: true, _removedConnection: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: null, _hasBody: true, _trailer: '', finished: false, _headerSent: false, _closed: false, socket: [Socket], _header: null, _keepAliveTimeout: 5000, _onPendingData: [Function: bound updateOutgoingData], req: [IncomingMessage], _sent100: false, _expect_continue: false, _maxRequestsPerSocket: 0, statusCode: 200, __onFinished: [Function], statusMessage: 'OK', [Symbol(kCapture)]: false, [Symbol(kBytesWritten)]: 0, [Symbol(kEndCalled)]: false, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype], [Symbol(kUniqueHeaders)]: null }, ctx: [Circular *1], request: <ref *2> { app: [Application], req: [IncomingMessage], res: [ServerResponse], ctx: [Circular *1], response: [Circular *3], originalUrl: '/auth/loginByWeixin', ip: '::ffff:10.13.254.168', accept: [Accepts], body: [Object], _querycache: [Object] }, _explicitStatus: true }, app: <ref *4> Application { _events: [Object: null prototype] { filterParam: [Function (anonymous)], appReady: [Function (anonymous)], routerChange: [Function (anonymous)], error: [Function: onerror] }, _eventsCount: 4, _maxListeners: undefined, proxy: false, middleware: [ [Function: cors], [Function (anonymous)], [Function: serve], [Function (anonymous)], [Function (anonymous)], [Function: router], [Function (anonymous)], [Function (anonymous)] ], subdomainOffset: 2, env: 'development', context: { referer: [Function: referer], referrer: [Function: referrer], isMethod: [Function: isMethod], isAjax: [Function: isAjax], isJsonp: [Function: isJsonp], jsonp: [Function: jsonp], json: [Function: json], success: [Function: success], fail: [Function: fail], expires: [Function: expires], config: [Function: config], param: [Function: param], post: [Function: post], file: [Function: file], cookie: [Function: cookie], service: [Function: service], download: [Function: download], model: [Function: model], cache: [Function: thinkCache] }, request: {}, response: {}, think: { app: [Circular *4], version: '3.2.7', messenger: [Messenger], Controller: [class Controller], Logic: [class Logic extends Controller], Service: [class Service], service: [Function (anonymous)], beforeStartServer: [Function (anonymous)], ROOT_PATH: '/app', APP_PATH: '/app/app', loader: [Loader], config: [Function (anonymous)], logger: [Logger], Model: [Function], model: [Function: injectModel], cache: [Function: thinkCache], userId: 0 }, modules: [ 'admin', 'api', 'common' ], models: { admin: [Object], api: [Object], common: {} }, services: { admin: [Object], api: [Object], common: {} }, logics: { admin: [Object], api: {}, common: {} }, controllers: { admin: [Object], api: [Object], common: {} }, routers: [], validators: {}, server: Server { maxHeaderSize: undefined, insecureHTTPParser: undefined, _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, _connections: 2, _handle: [Object], _usingWorkers: false, _workers: [], _unref: false, allowHalfOpen: true, pauseOnConnect: false, noDelay: false, keepAlive: false, keepAliveInitialDelay: 0, httpAllowHalfOpen: false, timeout: 0, keepAliveTimeout: 5000, maxHeadersCount: null, maxRequestsPerSocket: 0, headersTimeout: 60000, requestTimeout: 0, _connectionKey: '4:null:8360', [Symbol(IncomingMessage)]: [Function: IncomingMessage], [Symbol(ServerResponse)]: [Function: ServerResponse], [Symbol(kCapture)]: false, [Symbol(async_id_symbol)]: 28, [Symbol(kUniqueHeaders)]: null }, [Symbol(kCapture)]: false }, req: IncomingMessage { _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: BufferList { head: null, tail: null, length: 0 }, length: 0, pipes: [], flowing: true, ended: true, endEmitted: true, reading: false, constructed: true, sync: true, needReadable: false, emittedReadable: false, readableListening: false, resumeScheduled: false, errorEmitted: false, emitClose: true, autoDestroy: true, destroyed: true, errored: null, closed: true, closeEmitted: true, defaultEncoding: 'utf8', awaitDrainWriters: null, multiAwaitDrain: false, readingMore: true, dataEmitted: true, decoder: null, encoding: null, [Symbol(kPaused)]: false }, _events: [Object: null prototype] { end: [Function: clearRequestTimeout] }, _eventsCount: 1, _maxListeners: undefined, socket: Socket { connecting: false, _hadError: false, _parent: null, _host: null, _closeAfterHandlingError: false, _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 8, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: true, _sockname: null, _pendingData: null, _pendingEncoding: '', server: [Server], _server: [Server], parser: [HTTPParser], on: [Function: socketListenerWrap], addListener: [Function: socketListenerWrap], prependListener: [Function: socketListenerWrap], setEncoding: [Function: socketSetEncoding], _paused: false, _httpMessage: [ServerResponse], _peername: [Object], timeout: 10000, [Symbol(async_id_symbol)]: 12001, [Symbol(kHandle)]: [TCP], [Symbol(lastWriteQueueSize)]: 0, [Symbol(timeout)]: Timeout { _idleTimeout: 10000, _idlePrev: [TimersList], _idleNext: [TimersList], _idleStart: 1052929, _onTimeout: [Function: bound ], _timerArgs: undefined, _repeat: null, _destroyed: false, [Symbol(refed)]: false, [Symbol(kHasPrimitive)]: false, [Symbol(asyncId)]: 12006, [Symbol(triggerId)]: 12004 }, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]: null, [Symbol(kBufferGen)]: null, [Symbol(kCapture)]: false, [Symbol(kSetNoDelay)]: false, [Symbol(kSetKeepAlive)]: false, [Symbol(kSetKeepAliveInitialDelay)]: 0, [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0, [Symbol(RequestTimeout)]: undefined }, httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, rawHeaders: [ 'Host', 'express-phv4-21057-6-1315521450.sh.run.tcloudbase.com', 'X-Request-ID', '7b54447351c71aace1d233dcc133d1f9', 'X-Real-IP', '169.254.128.16', 'X-Forwarded-For', '169.254.128.16', 'X-Forwarded-Host', 'express-phv4-21057-6-1315521450.sh.run.tcloudbase.com', 'X-Forwarded-Port', '80', 'X-Forwarded-Proto', 'http', 'X-Scheme', 'http', 'X-Original-Forwarded-For', '111.60.237.109', 'Content-Length', '839', 'user-agent', 'accept', '*/*', 'x-wx-source', 'referer', 'https://servicewechat.com/wxe9b6bc936b5da1ee/devtools/page-frame.html', 'x-wx-service', 'express-phv4', 'x-wx-call-id', '0.07261793183878318_1669792002886', 'content-type', 'application/json' ], rawTrailers: [], aborted: false, upgrade: false, url: '/auth/loginByWeixin', method: 'POST', statusCode: null, statusMessage: null, client: Socket { connecting: false, _hadError: false, _parent: null, _host: null, _closeAfterHandlingError: false, _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 8, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: true, _sockname: null, _pendingData: null, _pendingEncoding: '', server: [Server], _server: [Server], parser: [HTTPParser], on: [Function: socketListenerWrap], addListener: [Function: socketListenerWrap], prependListener: [Function: socketListenerWrap], setEncoding: [Function: socketSetEncoding], _paused: false, _httpMessage: [ServerResponse], _peername: [Object], timeout: 10000, [Symbol(async_id_symbol)]: 12001, [Symbol(kHandle)]: [TCP], [Symbol(lastWriteQueueSize)]: 0, [Symbol(timeout)]: Timeout { _idleTimeout: 10000, _idlePrev: [TimersList], _idleNext: [TimersList], _idleStart: 1052929, _onTimeout: [Function: bound ], _timerArgs: undefined, _repeat: null, _destroyed: false, [Symbol(refed)]: false, [Symbol(kHasPrimitive)]: false, [Symbol(asyncId)]: 12006, [Symbol(triggerId)]: 12004 }, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]: null, [Symbol(kBufferGen)]: null, [Symbol(kCapture)]: false, [Symbol(kSetNoDelay)]: false, [Symbol(kSetKeepAlive)]: false, [Symbol(kSetKeepAliveInitialDelay)]: 0, [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0, [Symbol(RequestTimeout)]: undefined }, _consuming: false, _dumped: false, _parsedUrl: Url { protocol: null, slashes: null, auth: null, host: null, port: null, hostname: null, hash: null, search: null, query: null, pathname: '/auth/loginByWeixin', path: '/auth/loginByWeixin', href: '/auth/loginByWeixin', _raw: '/auth/loginByWeixin' }, [Symbol(kCapture)]: false, [Symbol(kHeaders)]: { host: 'express-phv4-21057-6-1315521450.sh.run.tcloudbase.com', 'x-request-id': '7b54447351c71aace1d233dcc133d1f9', 'x-real-ip': '169.254.128.16', 'x-forwarded-for': '169.254.128.16', 'x-forwarded-host': 'express-phv4-21057-6-1315521450.sh.run.tcloudbase.com', 'x-forwarded-port': '80', 'x-forwarded-proto': 'http', 'x-scheme': 'http', 'x-original-forwarded-for': '111.60.237.109', 'content-length': '839', 'user-agent': 'Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Mobile Safari/537.36 wechatdevtools/1.06.2210310 MicroMessenger/8.0.5 webview/', accept: '*/*', 'x-wx-env': 'prod-7gbq8yzb92e5aa90', 'x-wx-source': 'wx_devtools', referer: 'https://servicewechat.com//devtools/page-frame.html', 'x-wx-service': 'express-phv4', 'x-wx-call-id': '0.07261793183878318_1669792002886', 'content-type': 'application/json' }, [Symbol(kHeadersCount)]: 52, [Symbol(kTrailers)]: null, [Symbol(kTrailersCount)]: 0, [Symbol(RequestTimeout)]: undefined }, res: <ref *5> ServerResponse { _events: [Object: null prototype] { finish: [Array], end: [Function: onevent], timeout: [Function: requestTimeoutCallback] }, _eventsCount: 3, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: false, chunkedEncoding: false, shouldKeepAlive: true, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: true, sendDate: true, _removedConnection: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: null, _hasBody: true, _trailer: '', finished: false, _headerSent: false, _closed: false, socket: Socket { connecting: false, _hadError: false, _parent: null, _host: null, _closeAfterHandlingError: false, _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 8, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: true, _sockname: null, _pendingData: null, _pendingEncoding: '', server: [Server], _server: [Server], parser: [HTTPParser], on: [Function: socketListenerWrap], addListener: [Function: socketListenerWrap], prependListener: [Function: socketListenerWrap], setEncoding: [Function: socketSetEncoding], _paused: false, _httpMessage: [Circular *5], _peername: [Object], timeout: 10000, [Symbol(async_id_symbol)]: 12001, [Symbol(kHandle)]: [TCP], [Symbol(lastWriteQueueSize)]: 0, [Symbol(timeout)]: Timeout { _idleTimeout: 10000, _idlePrev: [TimersList], _idleNext: [TimersList], _idleStart: 1052929, _onTimeout: [Function: bound ], _timerArgs: undefined, _repeat: null, _destroyed: false, [Symbol(refed)]: false, [Symbol(kHasPrimitive)]: false, [Symbol(asyncId)]: 12006, [Symbol(triggerId)]: 12004 }, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]: null, [Symbol(kBufferGen)]: null, [Symbol(kCapture)]: false, [Symbol(kSetNoDelay)]: false, [Symbol(kSetKeepAlive)]: false, [Symbol(kSetKeepAliveInitialDelay)]: 0, [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0, [Symbol(RequestTimeout)]: undefined }, _header: null, _keepAliveTimeout: 5000, _onPendingData: [Function: bound updateOutgoingData], req: IncomingMessage { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, socket: [Socket], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, rawHeaders: [Array], rawTrailers: [], aborted: false, upgrade: false, url: '/auth/loginByWeixin', method: 'POST', statusCode: null, statusMessage: null, client: [Socket], _consuming: false, _dumped: false, _parsedUrl: [Url], [Symbol(kCapture)]: false, [Symbol(kHeaders)]: [Object], [Symbol(kHeadersCount)]: 52, [Symbol(kTrailers)]: null, [Symbol(kTrailersCount)]: 0, [Symbol(RequestTimeout)]: undefined }, _sent100: false, _expect_continue: false, _maxRequestsPerSocket: 0, statusCode: 200, __onFinished: [Function: listener] { queue: [Array] }, statusMessage: 'OK', [Symbol(kCapture)]: false, [Symbol(kBytesWritten)]: 0, [Symbol(kEndCalled)]: false, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype] { vary: [Array], 'x-powered-by': [Array] }, [Symbol(kUniqueHeaders)]: null }, originalUrl: '/auth/loginByWeixin', cookies: Cookies { secure: false, request: IncomingMessage { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, socket: [Socket], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, rawHeaders: [Array], rawTrailers: [], aborted: false, upgrade: false, url: '/auth/loginByWeixin', method: 'POST', statusCode: null, statusMessage: null, client: [Socket], _consuming: false, _dumped: false, _parsedUrl: [Url], [Symbol(kCapture)]: false, [Symbol(kHeaders)]: [Object], [Symbol(kHeadersCount)]: 52, [Symbol(kTrailers)]: null, [Symbol(kTrailersCount)]: 0, [Symbol(RequestTimeout)]: undefined }, response: <ref *5> ServerResponse { _events: [Object: null prototype], _eventsCount: 3, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: false, chunkedEncoding: false, shouldKeepAlive: true, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: true, sendDate: true, _removedConnection: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: null, _hasBody: true, _trailer: '', finished: false, _headerSent: false, _closed: false, socket: [Socket], _header: null, _keepAliveTimeout: 5000, _onPendingData: [Function: bound updateOutgoingData], req: [IncomingMessage], _sent100: false, _expect_continue: false, _maxRequestsPerSocket: 0, statusCode: 200, __onFinished: [Function], statusMessage: 'OK', [Symbol(kCapture)]: false, [Symbol(kBytesWritten)]: 0, [Symbol(kEndCalled)]: false, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype], [Symbol(kUniqueHeaders)]: null }, keys: undefined }, accept: Accepts { headers: { host: 'express-phv4-21057-6-1315521450.sh.run.tcloudbase.com', 'x-request-id': '7b54447351c71aace1d233dcc133d1f9', 'x-real-ip': '169.254.128.16', 'x-forwarded-for': '169.254.128.16', 'x-forwarded-host': 'express-phv4-21057-6-1315521450.sh.run.tcloudbase.com', 'x-forwarded-port': '80', 'x-forwarded-proto': 'http', 'x-scheme': 'http', 'x-original-forwarded-for': '111.60.237.109', 'content-length': '839', 'user-agent': 'Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Mobile Safari/537.36 wechatdevtools/1.06.2210310 MicroMessenger/8.0.5 webview/', 'x-cloudbase-trace': 'ZjgzZGU3ZmIxMDU2NDk1N2E4YzExZDI3OGU1MTk2ZWEsLG9mZg==', 'x-cloudbase-version': 'express-phv4-009', 'x-cloudbase-timestamp': '1669792003', accept: '*/*', referer: 'https://servicewechat.com//devtools/page-frame.html', 'x-wx-service': 'express-phv4', 'x-wx-call-id': '0.07261793183878318_1669792002886', 'content-type': 'application/json' }, negotiator: Negotiator { request: [IncomingMessage] } },