如何使用我自己的快速服务器获取 Electron CrashReporter?

问题描述 投票:0回答:0

我关注了很棒的帖子 electron-crashreporter-stay-up-to-date-if-your-app-fucked-up,但是 express POST API 无法处理崩溃文件。 我在“崩溃”的应用程序中使用 electron 版本“15.0.0”。 在我使用的快速服务器应用程序中:

"express": "^4.18.2",
"multer": "^1.4.3"

node js 版本 18.0.0

如何编写获取崩溃报告的 REST API? 我在 POST API 中得到的请求是:

> <ref *2> IncomingMessage {
> _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: BufferList { head: null, tail: null, length: 0 },
> length: 0, pipes: [], flowing: false, ended: true, endEmitted: true,
> reading: false, constructed: true, sync: false, 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: false, dataEmitted: true, decoder: null, encoding:
> null, [Symbol(kPaused)]: true },
> _events: [Object: null prototype] { end: [Function: clearRequestTimeout], readable: [Function: bound ] },
> _eventsCount: 2,
> _maxListeners: undefined, socket: <ref *1> Socket { connecting: false,
> _hadError: false,
> _parent: null,
> _host: null,
> _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: BufferList { head: null, tail: null, length: 0 },
> length: 0, pipes: [], flowing: true, ended: false, endEmitted: false,
> reading: true, constructed: true, sync: false, needReadable: true,
> emittedReadable: false, readableListening: false, resumeScheduled:
> false, errorEmitted: false, emitClose: false, autoDestroy: true,
> destroyed: false, errored: null, closed: false, closeEmitted: false,
> defaultEncoding: 'utf8', awaitDrainWriters: null, multiAwaitDrain:
> false, readingMore: false, dataEmitted: false, decoder: null,
> encoding: null, [Symbol(kPaused)]: false },
> _events: [Object: null prototype] { end: [Array], timeout: [Function: socketOnTimeout], data: [Function: bound socketOnData], error:
> [Function: socketOnError], close: [Array], drain: [Function: bound
> socketOnDrain], resume: [Function: onSocketResume], pause: [Function:
> onSocketPause] },
> _eventsCount: 8,
> _maxListeners: undefined,
> _writableState: WritableState { objectMode: false, highWaterMark: 16384, finalCalled: false, needDrain: false, ending: false, ended:
> false, finished: false, destroyed: false, decodeStrings: false,
> defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync:
> true, bufferProcessing: false, onwrite: [Function: bound onwrite],
> writecb: null, writelen: 0, afterWriteTickInfo: null, buffered: [],
> bufferedIndex: 0, allBuffers: true, allNoop: true, pendingcb: 0,
> constructed: true, prefinished: false, errorEmitted: false, emitClose:
> false, autoDestroy: true, errored: null, closed: false, closeEmitted:
> false, [Symbol(kOnFinished)]: [] }, allowHalfOpen: true,
> _sockname: null,
> _pendingData: null,
> _pendingEncoding: '', server: Server { maxHeaderSize: undefined, insecureHTTPParser: undefined,
> _events: [Object: null prototype],
> _eventsCount: 2,
> _maxListeners: undefined,
> _connections: 1,
> _handle: [TCP],
> _usingWorkers: false,
> _workers: [],
> _unref: false, allowHalfOpen: true, pauseOnConnect: false, httpAllowHalfOpen: false, timeout: 0, keepAliveTimeout: 5000,
> maxHeadersCount: null, maxRequestsPerSocket: 0, headersTimeout: 60000,
> requestTimeout: 0,
> _connectionKey: '6::::3000', [Symbol(IncomingMessage)]: [Function: IncomingMessage], [Symbol(ServerResponse)]: [Function:
> ServerResponse], [Symbol(kCapture)]: false, [Symbol(async_id_symbol)]:
> 4 },
> _server: Server { maxHeaderSize: undefined, insecureHTTPParser: undefined,
> _events: [Object: null prototype],
> _eventsCount: 2,
> _maxListeners: undefined,
> _connections: 1,
> _handle: [TCP],
> _usingWorkers: false,
> _workers: [],
> _unref: false, allowHalfOpen: true, pauseOnConnect: false, httpAllowHalfOpen: false, timeout: 0, keepAliveTimeout: 5000,
> maxHeadersCount: null, maxRequestsPerSocket: 0, headersTimeout: 60000,
> requestTimeout: 0,
> _connectionKey: '6::::3000', [Symbol(IncomingMessage)]: [Function: IncomingMessage], [Symbol(ServerResponse)]: [Function:
> ServerResponse], [Symbol(kCapture)]: false, [Symbol(async_id_symbol)]:
> 4 }, parser: HTTPParser { '0': [Function: bound setRequestTimeout],
> '1': [Function: parserOnHeaders], '2': [Function:
> parserOnHeadersComplete], '3': [Function: parserOnBody], '4':
> [Function: parserOnMessageComplete], '5': [Function: bound
> onParserExecute], '6': [Function: bound onParserTimeout],
> _headers: [],
> _url: '', socket: [Circular *1], incoming: [Circular *2], outgoing: null, maxHeaderPairs: 2000,
> _consumed: true, onIncoming: [Function: bound parserOnIncoming], [Symbol(owner_symbol)]: [HTTPServerAsyncResource] }, on: [Function:
> socketListenerWrap], addListener: [Function: socketListenerWrap],
> prependListener: [Function: socketListenerWrap], setEncoding:
> [Function: socketSetEncoding],
> _paused: false,
> _httpMessage: ServerResponse {
> _events: [Object: null prototype],
> _eventsCount: 1,
> _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,
> _contentLength: null,
> _hasBody: true,
> _trailer: '', finished: false,
> _headerSent: false,
> _closed: false, socket: [Circular *1],
> _header: null,
> _keepAliveTimeout: 5000,
> _onPendingData: [Function: bound updateOutgoingData], req: [Circular *2],
> _sent100: false,
> _expect_continue: false, locals: [Object: null prototype] {}, [Symbol(kCapture)]: false, [Symbol(kNeedDrain)]: false,
> [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype]
> }, [Symbol(async_id_symbol)]: 8, [Symbol(kHandle)]: TCP { reading:
> true, onconnection: null,
> _consumed: true, [Symbol(owner_symbol)]: [Circular *1] }, [Symbol(kSetNoDelay)]: false, [Symbol(lastWriteQueueSize)]: 0,
> [Symbol(timeout)]: null, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]:
> null, [Symbol(kBufferGen)]: null, [Symbol(kCapture)]: false,
> [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0,
> [Symbol(RequestTimeout)]: undefined }, httpVersionMajor: 1,
> httpVersionMinor: 1, httpVersion: '1.1', complete: true, rawHeaders: [
> 'Connection', 'Keep-Alive', 'Transfer-Encoding', 'chunked',
> 'Content-Type', 'multipart/form-data;
> boundary=---MultipartBoundary-mEXrv7CkK6TOIue0ytIhDeRZA0trOmtM---',
> 'Content-Encoding', 'gzip', 'User-Agent', 'Crashpad/0.8.0
> WinHTTP/10.0.22000.1641 Windows_NT/10.0.22000.1761 (x64)', 'Host',
> 'localhost:3000' ], rawTrailers: [], aborted: false, upgrade: false,
> url:
> '/api/app-crashes?product=Electron&version=15.0.0&guid=09053120-1871-443c-86c4-69e5d9875650',
> method: 'POST', statusCode: null, statusMessage: null, client: <ref
> *1> Socket { connecting: false,
> _hadError: false,
> _parent: null,
> _host: null,
> _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: BufferList { head: null, tail: null, length: 0 },
> length: 0, pipes: [], flowing: true, ended: false, endEmitted: false,
> reading: true, constructed: true, sync: false, needReadable: true,
> emittedReadable: false, readableListening: false, resumeScheduled:
> false, errorEmitted: false, emitClose: false, autoDestroy: true,
> destroyed: false, errored: null, closed: false, closeEmitted: false,
> defaultEncoding: 'utf8', awaitDrainWriters: null, multiAwaitDrain:
> false, readingMore: false, dataEmitted: false, decoder: null,
> encoding: null, [Symbol(kPaused)]: false },
> _events: [Object: null prototype] { end: [Array], timeout: [Function: socketOnTimeout], data: [Function: bound socketOnData], error:
> [Function: socketOnError], close: [Array], drain: [Function: bound
> socketOnDrain], resume: [Function: onSocketResume], pause: [Function:
> onSocketPause] },
> _eventsCount: 8,
> _maxListeners: undefined,
> _writableState: WritableState { objectMode: false, highWaterMark: 16384, finalCalled: false, needDrain: false, ending: false, ended:
> false, finished: false, destroyed: false, decodeStrings: false,
> defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync:
> true, bufferProcessing: false, onwrite: [Function: bound onwrite],
> writecb: null, writelen: 0, afterWriteTickInfo: null, buffered: [],
> bufferedIndex: 0, allBuffers: true, allNoop: true, pendingcb: 0,
> constructed: true, prefinished: false, errorEmitted: false, emitClose:
> false, autoDestroy: true, errored: null, closed: false, closeEmitted:
> false, [Symbol(kOnFinished)]: [] }, allowHalfOpen: true,
> _sockname: null,
> _pendingData: null,
> _pendingEncoding: '', server: Server { maxHeaderSize: undefined, insecureHTTPParser: undefined,
> _events: [Object: null prototype],
> _eventsCount: 2,
> _maxListeners: undefined,
> _connections: 1,
> _handle: [TCP],
> _usingWorkers: false,
> _workers: [],
> _unref: false, allowHalfOpen: true, pauseOnConnect: false, httpAllowHalfOpen: false, timeout: 0, keepAliveTimeout: 5000,
> maxHeadersCount: null, maxRequestsPerSocket: 0, headersTimeout: 60000,
> requestTimeout: 0,
> _connectionKey: '6::::3000', [Symbol(IncomingMessage)]: [Function: IncomingMessage], [Symbol(ServerResponse)]: [Function:
> ServerResponse], [Symbol(kCapture)]: false, [Symbol(async_id_symbol)]:
> 4 },
> _server: Server { maxHeaderSize: undefined, insecureHTTPParser: undefined,
> _events: [Object: null prototype],
> _eventsCount: 2,
> _maxListeners: undefined,
> _connections: 1,
> _handle: [TCP],
> _usingWorkers: false,
> _workers: [],
> _unref: false, allowHalfOpen: true, pauseOnConnect: false, httpAllowHalfOpen: false, timeout: 0, keepAliveTimeout: 5000,
> maxHeadersCount: null, maxRequestsPerSocket: 0, headersTimeout: 60000,
> requestTimeout: 0,
> _connectionKey: '6::::3000', [Symbol(IncomingMessage)]: [Function: IncomingMessage], [Symbol(ServerResponse)]: [Function:
> ServerResponse], [Symbol(kCapture)]: false, [Symbol(async_id_symbol)]:
> 4 }, parser: HTTPParser { '0': [Function: bound setRequestTimeout],
> '1': [Function: parserOnHeaders], '2': [Function:
> parserOnHeadersComplete], '3': [Function: parserOnBody], '4':
> [Function: parserOnMessageComplete], '5': [Function: bound
> onParserExecute], '6': [Function: bound onParserTimeout],
> _headers: [],
> _url: '', socket: [Circular *1], incoming: [Circular *2], outgoing: null, maxHeaderPairs: 2000,
> _consumed: true, onIncoming: [Function: bound parserOnIncoming], [Symbol(owner_symbol)]: [HTTPServerAsyncResource] }, on: [Function:
> socketListenerWrap], addListener: [Function: socketListenerWrap],
> prependListener: [Function: socketListenerWrap], setEncoding:
> [Function: socketSetEncoding],
> _paused: false,
> _httpMessage: ServerResponse {
> _events: [Object: null prototype],
> _eventsCount: 1,
> _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,
> _contentLength: null,
> _hasBody: true,
> _trailer: '', finished: false,
> _headerSent: false,
> _closed: false, socket: [Circular *1],
> _header: null,
> _keepAliveTimeout: 5000,
> _onPendingData: [Function: bound updateOutgoingData], req: [Circular *2],
> _sent100: false,
> _expect_continue: false, locals: [Object: null prototype] {}, [Symbol(kCapture)]: false, [Symbol(kNeedDrain)]: false,
> [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype]
> }, [Symbol(async_id_symbol)]: 8, [Symbol(kHandle)]: TCP { reading:
> true, onconnection: null,
> _consumed: true, [Symbol(owner_symbol)]: [Circular *1] }, [Symbol(kSetNoDelay)]: false, [Symbol(lastWriteQueueSize)]: 0,
> [Symbol(timeout)]: null, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]:
> null, [Symbol(kBufferGen)]: null, [Symbol(kCapture)]: false,
> [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0,
> [Symbol(RequestTimeout)]: undefined },
> _consuming: true,
> _dumped: false, next: [Function: next], baseUrl: '', originalUrl: '/api/app-crashes?product=Electron&version=15.0.0&guid=09053120-1871-443c-86c4-69e5d9875650',
> _parsedUrl: Url { protocol: null, slashes: null, auth: null, host: null, port: null, hostname: null, hash: null, search:
> '?product=Electron&version=15.0.0&guid=09053120-1871-443c-86c4-69e5d9875650',
> query:
> 'product=Electron&version=15.0.0&guid=09053120-1871-443c-86c4-69e5d9875650',
> pathname: '/api/app-crashes', path:
> '/api/app-crashes?product=Electron&version=15.0.0&guid=09053120-1871-443c-86c4-69e5d9875650',
> href:
> '/api/app-crashes?product=Electron&version=15.0.0&guid=09053120-1871-443c-86c4-69e5d9875650',
> _raw: '/api/app-crashes?product=Electron&version=15.0.0&guid=09053120-1871-443c-86c4-69e5d9875650'
> }, params: {}, query: { product: 'Electron', version: '15.0.0', guid:
> '09053120-1871-443c-86c4-69e5d9875650' }, res: <ref *3> ServerResponse
> {
> _events: [Object: null prototype] { finish: [Function: bound resOnFinish] },
> _eventsCount: 1,
> _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,
> _contentLength: null,
> _hasBody: true,
> _trailer: '', finished: false,
> _headerSent: false,
> _closed: false, socket: <ref *1> Socket { connecting: false,
> _hadError: false,
> _parent: null,
> _host: null,
> _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 *3], [Symbol(async_id_symbol)]: 8, [Symbol(kHandle)]: [TCP], [Symbol(kSetNoDelay)]: false,
> [Symbol(lastWriteQueueSize)]: 0, [Symbol(timeout)]: null,
> [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]: null,
> [Symbol(kBufferGen)]: null, [Symbol(kCapture)]: false,
> [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0, TypeError: Cannot
> read properties of undefined (reading 'filename') at
> C:\Git\playground\js-express\index.js:20:32 at Layer.handle [as
> handle_request]
> (C:\Git\playground\js-express\node_modules\express\lib\router\layer.js:95:5)
> at next
> (C:\Git\playground\js-express\node_modules\express\lib\router\route.js:144:13)
> at Immediate.
> (C:\Git\playground\js-express\node_modules\multer\lib\make-middleware.js:53:37)
> at processImmediate (node:internal/timers:466:21)  
node.js express electron crash-reports
© www.soinside.com 2019 - 2024. All rights reserved.