Too many properties to enumerate when calling documents().import()

See original GitHub issue

Reported on Slack.

Request #1626169731197: Request to Node 0 failed due to "undefined Too many properties to enumerate"
Request #1626169731197: Sleeping for 0.1s and then retrying request...
Request #1626169731197: Request to Node 0 failed due to "undefined Too many properties to enumerate"
Request #1626169731197: Sleeping for 0.1s and then retrying request...
RangeError: Too many properties to enumerate
    at Function.keys (<anonymous>)
    at ApiCall._callee$ (/home/<>/Documents/dt-site-search/node_modules/typesense/lib/Typesense/ApiCall.js:155:46)
    at tryCatch (/home/<>/Documents/dt-site-search/node_modules/regenerator-runtime/runtime.js:63:40)
    at Generator.invoke [as _invoke] (/home/<>/Documents/dt-site-search/node_modules/regenerator-runtime/runtime.js:293:22)
    at Generator.next (/home/<>/Documents/dt-site-search/node_modules/regenerator-runtime/runtime.js:118:21)
    at asyncGeneratorStep (/home/<>/Documents/dt-site-search/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
    at _next (/home/<>/Documents/dt-site-search/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)

This happens due to a JS limitation: https://stackoverflow.com/questions/9282869/are-there-limits-to-the-number-of-properties-in-a-javascript-object. This also happens for large arrays of objects for some reason.

Instead of calling JSON.stringify on the entire array of objects here, we could split large arrays into smaller ones, then call JSON.stringify on them individually and then concat them together. So users of the client library don’t have to do this themselves.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
skipjackcommented, Jan 26, 2022

Awesome guys, was running into this quite frequently with some non-indexed properties. The new version of this package not only fixed it but also seemed to potentially speed up loading a bit (at least in our case with ~20k documents for this particular index).

1reaction
jasonboscocommented, Nov 19, 2021

@akash-joshi That’s a good catch! 65K keys on a single object does sound like a lot. I like the idea of catching this error and showing a friendly error message, and may be pointing people to a stackoverflow issue explaining the underlying issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enumerability and ownership of properties - JavaScript | MDN
Every property in JavaScript objects can be classified by three factors: Enumerable or non-enumerable;; String or symbol;; Own property or ...
Read more >
Too many properties in a js object - javascript - Stack Overflow
One thing I'd advise against is your second option, in a literal sense; options = [ true, true, true, true, false, true, true,...
Read more >
Built-in Functions — Python 3.11.1 documentation
This function drops you into the debugger at the call site. Specifically, it calls sys.breakpointhook() , passing args and kws straight through.
Read more >
Python import: Advanced Techniques and Tips
In this tutorial, you'll learn how to: Use modules, packages, and namespace packages; Handle resources and data files inside your packages; Import modules ......
Read more >
Operation Limits in Dynamics 365 Business Central
READTEXT method calls. This setting pertains to UTF-8 and UTF-16 text encoding; not MS-DOS encoding. 1,000,000 bytes. Database limits ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found