I had a local patch for relational-pouch for a while, that set the limit on requests to 2**32-1 instead of the default very low value.
I was happy to see the recent update 4.1.0 that changed the limit, however the value chosen doesn't work. I had tried it myself without success. And indeed, with the new version of relational-pouch, I am getting the following error on Chrome 128:
TypeError: Failed to execute 'getAll' on 'IDBObjectStore': Value is outside the 'unsigned long' value range.
This PR fixes the issue by setting the limit to 2**32-1 instead of Number.MAX_SAFE_INTEGER, which appears to be the biggest number that works with IDBObjectStore.
I hope this gets merged soon. In the meantime, for anyone encountering this issue, here is how to patch the previous version without too much overhead:
Install "relational-pouch": "=4.0.4"
Install "patch-package": "^8.0.0"
Either
Create a folder name patches at the root of the project
Create a file called relational-pouch+4.0.4.patch inside that folder
Paste the following content into the file:
diff --git a/node_modules/relational-pouch/lib/index.js b/node_modules/relational-pouch/lib/index.js
index 50b7872..64262a5 100644
--- a/node_modules/relational-pouch/lib/index.js
+++ b/node_modules/relational-pouch/lib/index.js
@@ -363,7 +363,7 @@ function createRel(db, keysToSchemas, schema) {
};
selector['data.' + belongsToKey] = belongsToId;
//only use opts for return ids or whole doc? returning normal documents is not really good
- let findRes = await db.find({ selector: selector });
+ let findRes = await db.find({ selector: selector, limit: 2**32-1 });
return _parseRelDocs(type, foundObjects, findRes.docs);
}
function findHasMany(type, belongsToKey, belongsToId) {
Or
Edit the file manually in node_modules, then run patch-package relational-pouch
I suppose you could also patch the latest version this way...
I stopped my editor from reformatting the file, however it seems to have created whitespace differences. Sorry about that.
I had a local patch for
relational-pouch
for a while, that set the limit on requests to2**32-1
instead of the default very low value.I was happy to see the recent update
4.1.0
that changed the limit, however the value chosen doesn't work. I had tried it myself without success. And indeed, with the new version ofrelational-pouch
, I am getting the following error on Chrome 128:TypeError: Failed to execute 'getAll' on 'IDBObjectStore': Value is outside the 'unsigned long' value range.
This PR fixes the issue by setting the limit to
2**32-1
instead ofNumber.MAX_SAFE_INTEGER
, which appears to be the biggest number that works withIDBObjectStore
.I hope this gets merged soon. In the meantime, for anyone encountering this issue, here is how to patch the previous version without too much overhead:
"relational-pouch": "=4.0.4"
"patch-package": "^8.0.0"
patches
at the root of the projectrelational-pouch+4.0.4.patch
inside that foldernode_modules
, then runpatch-package relational-pouch
I stopped my editor from reformatting the file, however it seems to have created whitespace differences. Sorry about that.