upsert
upsert copied to clipboard
typeError PouchPromise.reject is not a function
with react.js on node.js stack
"npm": "6.14.15",
"node": "14.18.1" "promise": "^8.1.0", "pouchdb": "^7.2.2", "pouchdb-find": "^7.2.2", "pouchdb-upsert": "^2.2.0", "react": "^17.0.2",
Bug in pouchdb-upsert/index.js This seems to be analogous to a promise.resolve bug others have spotted with similar fix:
function upsertInner(db, docId, diffFun) { if (typeof docId !== 'string') { return PouchPromise.reject(new Error('doc id is required')); }
fails to transpile with typeError PouchPromise.reject is not a function.
This following fix seems to allow the code to transpile correctly: //node_modules/pouchdb-upsert/index.js - line 4 //var PouchPromise = require('pouchdb-promise'); //to //var PouchPromise = require('pouchdb-promise').default;