H2Owater425 / node-hitomi

Hitomi.la api for Node.js
https://npm.im/node-hitomi
MIT License
15 stars 2 forks source link

UnhandledPromiseRejectionWarning: Error: incorrect header check #26

Closed dnm13 closed 3 years ago

dnm13 commented 3 years ago

Had a version jump, so I don't actually know from which version this error appears (from v3.0.1 to v3.1.0)

(node:30432) UnhandledPromiseRejectionWarning: Error: incorrect header check
    at Zlib.zlibOnError [as onerror] (zlib.js:181:17)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:30432) 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: 1)
(node:30432) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

code:

import hitomi from 'node-hitomi'
hitomi.getGalleryData(2008107)
  .then(async (gallery) => {
    console.log(gallery);
})

just a guess, but probably ever from dependency change from node-fetch to https

H2Owater425 commented 3 years ago

When I removed the package's dependency from node-fetch, requesting function that I made was getting a compressed response (as used to). So I had to use an uncompressing module to get raw data from Hitomi (and it was Zlib). But I soon realized with some benchmarks I made that getting a raw response was way faster than getting a compressed one. It could be a little annoying, but I want you to use the latest version of the package. It will solve the problem due to caused by Zlib.

dnm13 commented 3 years ago

huh that's weird I wanted to update the package by using npm i node-hitomi, but i guess it doesn't point to the latest version (v4.1.1) it's solved now (had to run npm i node-hitomi@latest this time)