ChiriVulpes / scryfall-sdk

A Node.js SDK for https://scryfall.com/docs/api, written in TypeScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

this._listeners[eventName] is not iterable

ryder-james opened this issue · comments

Running a fairly simple search:

const commanders = [];
Scry.Cards.search('is:commander legal:commander game:paper')
	.on('data', card => {
		commanders.push(card);
	})
	.on('end', () => {
		console.log(`found ${commanders.length} results`);
	});

But getting this error:

<path>\node_modules\scryfall-sdk\out\util\EventEmitter.js:70
        for (const listener of this._listeners[eventName])
                                              ^

TypeError: this._listeners[eventName] is not iterable
    at MagicEmitter.emit (<path>\node_modules\scryfall-sdk\out\util\EventEmitter.js:70:47)
    at MagicEmitter.emit (<path>\node_modules\scryfall-sdk\out\util\MagicEmitter.js:51:22)
    at <path>\node_modules\scryfall-sdk\out\api\Cards.js:433:35
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Hmm, I think this is the same thing fixed by the suggested PR #69, I wonder why this wouldn't be covered by the existing tests. I'll take a look tomorrow. Thanks for the report!

Fixed as of v4.2.2 via #69