Update to 3.5.3 and PouchDB

Fixed by adding:

"pouchdb-adapter-websql-core": "6.2.0"

Seems to be related to: https://github.com/pouchdb/pouchdb/issues/6615, https://github.com/pouchdb/pouchdb/issues/6630.

2 Likes

Adding “pouchdb-adapter-websql-core”: “6.2.0” fixed the problem for me.
That’s strange, because I use the adapter “cordova-sqlite” when I do a “new PouchDB(…)”

pouchdb-adapter-websql uses pouchdb-adapter-websql-core too.

Same for me here … I am using cordova-sqlite for Android, so I am not quite sure why pouchdb-adapter-websql-core is needed :slight_smile:

Can you provide an example of how you are using pouchdb-adapter-websql-core? I’m still encountering odd errors related to this issue.

I have got it working doing the following:

  1. Removed node_models directory
  2. added the following to my packages.json
    "pouchdb": "6.2.0",
    "pouchdb-find": "^6.2.0",
    "pouchdb-adapter-cordova-sqlite": "2.0.2",
    "pouchdb-adapter-websql-core": "6.2.0",
    "pouchdb-browser": "6.2.0",
    "pouchdb-core": "6.2.0",
  1. Ran npm install

It all worked on first run - thanks matheusgarcez

4 Likes

Whoa, no idea why this works but it does! Thanks!

This configuration fixed the issue of “WebSqlPouchCore.call is not a function”

This worked. Kindly add this to package.json then run npm install to fix it.

I recently updated to Ionic 3 and tried to run pouchdb in my project. Putting all those dependencies from above (newer versions) did not solve the Problem for me :frowning:

Any ideas why it does not work with the latest versions and how to fix it?

Ionic Info

cli packages: (C:\Users…\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.12.0
ionic (Ionic CLI) : 3.12.0

global packages:

cordova (Cordova CLI) : 7.0.1

local packages:

@ionic/app-scripts : 2.1.4
Cordova Platforms  : android 6.2.3 browser 4.1.0
Ionic Framework    : ionic-angular 3.6.0

System:

Android SDK Tools : 26.0.2
Node              : v8.6.0
npm               : 5.3.0
OS                : Windows 10

Misc:

backend : pro

I’m using the latest PouchDB (with SQLite) by:

import PouchDB from 'pouchdb';

These are the entries in package.json there is an import error that’s not yet fixed so you need to use a PR branch:

        "@types/pouchdb": "^6.3.0",
        "pouchdb": "6.3.4",
        "pouchdb-adapter-cordova-sqlite": "git+https://github.com/SnceGroup/pouchdb-adapter-cordova-sqlite.git",
        "pouchdb-adapter-websql-core": "6.3.4",
        "pouchdb-browser": "6.3.4",
        "pouchdb-core": "6.3.4",

I don’t know if the @types/pouchdb is strictly necessary.

2 Likes

Hi,
This issue isn’t related to the Ionic environment. The root cause has been identified in the pouchdb adapter sqlite repo (see https://github.com/pouchdb-community/pouchdb-adapter-cordova-sqlite/issues/78).

Until the fix is released, you can monkey patch the lib/index.js file in your node_modules/pouchdb-adapter-cordova-sqlite to make things work (it worked for me).

Cheers

5 Likes

FWIW, I went through all kinds of pain with this over the last two days. @n40jpj had most of what I needed and I ended up needing these two plugins

<plugin name="cordova-plugin-sqlite-2" spec="^1.0.4" />
<plugin name="cordova-sqlite-storage" spec="^2.2.1" />

…and these NPM packages so that both the connection and basic commands worked without errors, but also the weird sync() script errors I was getting:

"pouchdb": "6.2.0",
"pouchdb-adapter-cordova-sqlite": "2.0.2",
"pouchdb-adapter-websql-core": "6.2.0",
"pouchdb-browser": "6.2.0",
"pouchdb-core": "6.2.0",
"pouchdb-find": "^6.2.0",

HTH