node-sitemap-stream-parser icon indicating copy to clipboard operation
node-sitemap-stream-parser copied to clipboard

Error: Callback was already called

Open max-frai opened this issue 6 years ago • 6 comments
trafficstars

When I parse this sitemap: https://gazeta.ua/sitemaps/sitemapindex.xml it fails with:

...node_modules/async/dist/async.js:966
        if (fn === null) throw new Error("Callback was already called.");
                         ^

Error: Callback was already called.
    at ...node_modules/async/dist/async.js:966:32
    at SAXStream.parserStream.on (...node_modules/sitemap-stream-parser/index.js:98:16)
    at SAXStream.emit (events.js:197:13)
    at SAXParser.SAXStream._parser.onend (...node_modules/sax/lib/sax.js:190:10)
    at emit (...node_modules/sax/lib/sax.js:624:35)
    at end (...node_modules/sax/lib/sax.js:667:5)
    at SAXParser.end (...node_modules/sax/lib/sax.js:154:24)
    at SAXStream.end (...node_modules/sax/lib/sax.js:248:18)
    at Gzip.onend (_stream_readable.js:655:10)
    at Object.onceWrapper (events.js:285:13)
    at Gzip.emit (events.js:202:15)
    at endReadableNT (_stream_readable.js:1129:12)
    at processTicksAndRejections (internal/process/next_tick.js:76:17)

I'm not sure what's the reason of this. Probably on(error) and on(end) are called for one parse url? But how coult it be possible?

max-frai avatar Feb 25 '19 13:02 max-frai

I'm having the same issue!! and I Can't even catch the error.. it just breaks the execution..

lizaaard avatar Feb 25 '19 14:02 lizaaard

When I parse this sitemap: https://gazeta.ua/sitemaps/sitemapindex.xml it fails with:

...node_modules/async/dist/async.js:966
        if (fn === null) throw new Error("Callback was already called.");
                         ^

Error: Callback was already called.
    at ...node_modules/async/dist/async.js:966:32
    at SAXStream.parserStream.on (...node_modules/sitemap-stream-parser/index.js:98:16)
    at SAXStream.emit (events.js:197:13)
    at SAXParser.SAXStream._parser.onend (...node_modules/sax/lib/sax.js:190:10)
    at emit (...node_modules/sax/lib/sax.js:624:35)
    at end (...node_modules/sax/lib/sax.js:667:5)
    at SAXParser.end (...node_modules/sax/lib/sax.js:154:24)
    at SAXStream.end (...node_modules/sax/lib/sax.js:248:18)
    at Gzip.onend (_stream_readable.js:655:10)
    at Object.onceWrapper (events.js:285:13)
    at Gzip.emit (events.js:202:15)
    at endReadableNT (_stream_readable.js:1129:12)
    at processTicksAndRejections (internal/process/next_tick.js:76:17)

I'm not sure what's the reason of this. Probably on(error) and on(end) are called for one parse url? But how coult it be possible?

btw.. rolling back to 1.6.0 works

lizaaard avatar Feb 25 '19 15:02 lizaaard

Hm, the 1.7.0 was my change from unzip to gzip to auto recognize zip algorithm.

max-frai avatar Feb 25 '19 15:02 max-frai

Hm, the 1.7.0 was my change from unzip to gzip to auto recognize zip algorithm.

yep.. it happens only on sitemap indexes which contain nested sitemaps with ".xml.gz" extensions...

on non-compressed sitemaps works fine

lizaaard avatar Feb 25 '19 15:02 lizaaard

Hey @max-frai, @lizaaard. Thanks for reporting this. I have been meaning to rewrite this thing in a slightly modern version with some upgraded dependencies. Been wanting to migrate away from Coffeescript and Request for a while anyway. Going to see how far I get today with this..

evanderkoogh avatar Feb 25 '19 23:02 evanderkoogh

Any update on this?

etairi avatar Jun 30 '19 11:06 etairi