Iterating an index throwing 'is not a function or its return value is not async iterable' error
See original GitHub issueIn this section of the demo code below, I receive a ‘TypeError: index.iterate(…) is not a function or its return value is not async iterable’:
// Add 'And, happy new year!' to all articles on 2019-01-01:
{
const tx = db.transaction('articles', 'readwrite');
const index = tx.store.index('date');
for await (const cursor of index.iterate(new Date('2019-01-01'))) {
const article = { ...cursor.value };
article.body += ' And, happy new year!';
cursor.update(article);
}
await tx.done;
}
I am working in the latest version of Chrome (v83). The database and index are created but just having issues with this index iterate.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
The meaning of "'x' is not a function or its return value is not ...
asyncIterator implemented it will throw this error. On the first case, the Symbol it's a constant, so it's not iterable.
Read more >TypeError: 'x' is not iterable - JavaScript - MDN Web Docs
Calling a generator produces an iterable object which will iterate over the values yielded during the execution of the generator. function* generate(a, b)...
Read more >Problems with Example 14.6 · Issue #193 · w3c/webtransport
Error while reading from stream #1": TypeError: stream.readable.pipeThrough(...).getReader(...) is not a function or its return value is not async iterable
Read more >Node.js v19.3.0 Documentation
If asyncFn is a function and it throws an error synchronously, assert.doesNotReject() will return a rejected Promise with that error. If the function...
Read more >Iterables - The Modern JavaScript Tutorial
When for..of starts, it calls that method once (or errors if not found). The method must return an iterator – an object with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Note that you need a different import for async iterators https://github.com/jakearchibald/idb#async-iterators.
Please reopen if this isn’t the issue.
Sorry it wasn’t there earlier!