six7 / figma-assets-generator

Creates assets (SVG, JPG, PNG) from a figma document (e.g. a "Icons" page in one of your files) and places them locally in a folder.
90 stars 10 forks source link

Unhandled promise rejection error #10

Closed annca closed 3 weeks ago

annca commented 3 years ago

Hi there! I've been using this library consistently for the last few months and it's working great. However, sometimes, I see these errors during export, so some of the assets fail. Have you seen this on your side? Can something be done in the script to handle these errors? Would appreciate your help.

at ClientRequest.emit (events.js:314:20)
    at TLSSocket.socketErrorListener (_http_client.js:428:9)
    at TLSSocket.emit (events.js:314:20)
    at errorOrDestroy (internal/streams/destroy.js:108:12)
    at onwriteError (_stream_writable.js:424:5)
    at onwrite (_stream_writable.js:445:5)
    at internal/streams/destroy.js:50:7
    at TLSSocket.Socket._destroy (net.js:681:5)
    at TLSSocket.destroy (internal/streams/destroy.js:38:8)
(node:32097) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)
(node:32097) UnhandledPromiseRejectionWarning: FetchError: request to https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/9bbe/6291/ebac3fc3bc48cbabf61f0d4766eb6eaa failed, reason: write EPROTO
    at ClientRequest.<anonymous> (/Users/.../node_modules/node-fetch/lib/index.js:1455:11)
    at ClientRequest.emit (events.js:314:20)
    at TLSSocket.socketErrorListener (_http_client.js:428:9)
    at TLSSocket.emit (events.js:314:20)
    at errorOrDestroy (internal/streams/destroy.js:108:12)
    at onwriteError (_stream_writable.js:424:5)
    at onwrite (_stream_writable.js:445:5)
    at internal/streams/destroy.js:50:7
    at TLSSocket.Socket._destroy (net.js:681:5)
    at TLSSocket.destroy (internal/streams/destroy.js:38:8)
(node:32097) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)
(node:32097) UnhandledPromiseRejectionWarning: FetchError: request to https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/7dbd/6983/83f49161f916bd75e1a9e23f9e06af9b failed, reason: write EPROTO
    at ClientRequest.<anonymous> (/Users/.../node_modules/node-fetch/lib/index.js:1455:11)
    at ClientRequest.emit (events.js:314:20)
    at TLSSocket.socketErrorListener (_http_client.js:428:9)
    at TLSSocket.emit (events.js:314:20)
    at errorOrDestroy (internal/streams/destroy.js:108:12)
    at onwriteError (_stream_writable.js:424:5)
    at onwrite (_stream_writable.js:445:5)
    at internal/streams/destroy.js:50:7
    at TLSSocket.Socket._destroy (net.js:681:5)
    at TLSSocket.destroy (internal/streams/destroy.js:38:8)
(node:32097) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 10)
(node:32097) UnhandledPromiseRejectionWarning: FetchError: request to https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/7375/d6a6/6e7246f9768ebf0ff794c19620dce142 failed, reason: read ECONNRESET
    at ClientRequest.<anonymous> (/Users/.../node_modules/node-fetch/lib/index.js:1455:11)
    at ClientRequest.emit (events.js:314:20)
    at TLSSocket.socketErrorListener (_http_client.js:428:9)
    at TLSSocket.emit (events.js:314:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:32097) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 11)
six7 commented 3 years ago

Hey there! Thanks for reporting this!

Hm, I can only imagine this might have to do with figma's API sometimes not being able to handle the request, however we should try to re-fetch it once that occurs. I will dig into this, however I'm not sure when I'll be able to get to it.