Compatible pouchdb-Browser versions
See original GitHub issueHello,
I initialize hoodie in a typescript/react project like this:
const PouchDB = require('pouchdb-browser');
const pouchdb = PouchDB.default.defaults({ revs_limit: this.revisionLimit, auto_compaction: true });
const Hoodie = require('@hoodie/client');
const hoodie = new Hoodie({
url: someUrl
PouchDB: pouchdb
});
When I use the latest pouchdb-browser version (7.1.1.) I experience the following behavior when I try to connect to the hoodie backend:
- SignUp and SignIn are working
- Normally in a working environment after signing in Hoodie/ PouchDb try to connect (Console message “The above 404 is totally normal. PouchDB is just checking if a remote checkpoint exists.” is shown) but this does not work.
- Instead I see a “unauthorized” request and a “getCheckpoint rejected with” error:
GET http://.../hoodie/store/api/user%.../ 401 (Unauthorized)
customPouchError {statusCode: 401, error: "Unauthorized", status: 401, name: "Unauthorized", message: "getCheckpoint rejected with ", …}
error: "Unauthorized"
message: "getCheckpoint rejected with "
name: "Unauthorized"
result: {ok: false, start_time: "...", docs_read: 0, docs_written: 0, doc_write_failures: 0, …}
status: 401
statusCode: 401
The combination of hoodie@28.2.9, @hoodie/client@10.1.1 and pouchdb-browser@6.4.3 seems to work. So is the latest pouchdb-browser not supported by hoodie?
Kind Regards
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
FAQ - PouchDB
Can PouchDB sync with MongoDB/MySQL/my current non-CouchDB database? No, your backend needs to speak the CouchDB replication protocol. The magic of PouchDB <–> ......
Read more >pouchdb-browser versions and peer dependencies
Online Peer dependency version tool to search for compatible versions of related NPM packages.
Read more >Enlist the major browsers supported by pouchdb? - Online...
The browsers that are supported by pouchdb are : Chrome 30 Safari 5.
Read more >pouchdb-browser - npm
PouchDB, the browser-only edition.. Latest version: 8.0.0, last published: 13 days ago. Start using pouchdb-browser in your project by ...
Read more >Bundling pouchdb-adapter-memory with Rollup - Stack Overflow
"readable-stream": "npm:vite-compatible-readable-stream@^3.6.0", ... The final issue is that PouchDB is using an ancient version of memdown ...
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 FreeTop 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
Top GitHub Comments
I did some more research: As expectet it has something to do with the authorization header. In @hoodie\client\lib\get-api.js the PouchDB request is build like this:
Since PouchDB 7 there is a change about the request handling, see also chapter “Switch to fetch” on https://github.com/pouchdb/pouchdb/releases/tag/7.0.0 And: https://github.com/pouchdb-community/pouchdb-authentication/issues/239
On the following picture on the left is pouch 6.4.3. You can see the “Ajax.headers” are evaluated. On the right in pouch 7.1.1, this is no longer the case. (Only a “header object is evaluated)
So if I change the PouchDB init to something like this it seems to work:
Now there is no “unauthorized error” anymore and the sync works but I’m not sure if this is enough and unfortunately, I’m not sure how to handle this now. I would like to do a PR but I can’t find the right pouch dependency in the hoodie client stuff and I also don’t know how to fix it without breaking old stuff. If someone could give me a little guidance what to do next, I would really appreciate and will try to create a PR.
I need to dig some deeper in the hoodie/pouchdb stuff because this is my first ever contact with it, but if I can figure it out I’ll try to do a PR.