Update to 3.5.3 and PouchDB

Since the update to Ionic 3.5.3 and app-scripts 2.0.2 today, I’m getting the following error when using PouchDB:

Runtime Error
Uncaught (in promise): TypeError: WebSqlPouchCore.call is not a function TypeError: WebSqlPouchCore.call is not a function at PouchDB$5.CordovaSQLitePouch (http://localhost:8100/build/main.js:117531:19) at new PouchDB$5 (http://localhost:8100/build/main.js:122515:36) at BirthdayService.initDB (http://localhost:8100/build/main.js:132161:20) at http://localhost:8100/build/main.js:38262:35 at t.invoke (http://localhost:8100/build/polyfills.js:3:9283) at Object.onInvoke (http://localhost:8100/build/main.js:4501:37) at t.invoke (http://localhost:8100/build/polyfills.js:3:9223) at r.run (http://localhost:8100/build/polyfills.js:3:4452) at http://localhost:8100/build/polyfills.js:3:14076 at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9967)

Show us your ionic info output please.

How did you implement PouchDB? What is your code causing this error?

just inserted `import PouchDB from ‘pouchdb’;

That solved it? Then please select your own post as “This reply solves this problem” (checkbox icon under the text).

I got the same error, I was following an tutorial from internet: https://gonehybrid.com/how-to-use-pouchdb-sqlite-for-local-storage-in-ionic-2/
The stack shows:
Error: Uncaught (in promise): TypeError: WebSqlPouchCore.call is not a function
TypeError: WebSqlPouchCore.call is not a function
at PouchDB$5.CordovaSQLitePouch (http://localhost:8100/build/vendor.js:128772:19)
at new PouchDB$5 (http://localhost:8100/build/vendor.js:118566:36)
at BirthdayService.webpackJsonp.99.BirthdayService.initDB (http://localhost:8100/build/main.js:342:20)
at http://localhost:8100/build/main.js:63:35
at t.invoke (http://localhost:8100/build/polyfills.js:3:9283)
at Object.onInvoke (http://localhost:8100/build/vendor.js:4508:37)
at t.invoke (http://localhost:8100/build/polyfills.js:3:9223)
at r.run (http://localhost:8100/build/polyfills.js:3:4452)
at http://localhost:8100/build/polyfills.js:3:14076
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9967)
at c (http://localhost:8100/build/polyfills.js:3:13535)
at http://localhost:8100/build/polyfills.js:3:14107
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9967)
at Object.onInvokeTask (http://localhost:8100/build/vendor.js:4499:37)
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9888)
at r.runTask (http://localhost:8100/build/polyfills.js:3:5143)
at o (http://localhost:8100/build/polyfills.js:3:2203)
at HTMLDocument.invoke (http://localhost:8100/build/polyfills.js:3:10985)

ionic info:
global packages:

@ionic/cli-utils : 1.5.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.5.0

local packages:

@ionic/app-scripts              : 2.0.2
@ionic/cli-plugin-cordova       : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms               : ios 4.4.0
Ionic Framework                 : ionic-angular 3.5.3

System:

Node       : v6.9.5
OS         : macOS Sierra
Xcode      : Xcode 8.3.3 Build version 8E3004b
ios-deploy : not installed
ios-sim    : 5.0.13
npm        : 3.10.10

I have changed the import as Keithlenne suggested, but the error remains the same.
Any idea please?

I am seeing the same issue - I’ve looked through every variant I can of how to use pouch db - any joy in finding a solution?

Same error but with

Cordova CLI : 7.0.1
Ionic CLI : 3.3.0

local packages:

@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms : ios 4.4.0
Ionic Framework : ionic-angular 3.3.0

I already have the import Keithlenne suggested.

Did this work before? When and why did it break for you?

Yes it worked before. We have a version in production since 2 or 3 months.
I built a version last week which is working.
I’m trying to find if I changed something since then … nothing yet.

1 Like

Same problem:

global packages:

@ionic/cli-utils : 1.5.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.5.0

local packages:

@ionic/app-scripts              : 2.0.2
@ionic/cli-plugin-cordova       : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms               : android 6.2.3
Ionic Framework                 : ionic-angular 3.5.2

System:
Node : v8.1.2
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 5.0.3

Stack trace:

Internal Error: WebSqlPouchCore.call is not a function
vendor.js:209710 TypeError: WebSqlPouchCore.call is not a function
    at PouchDB$3.CordovaSQLitePouch (file:///android_asset/www/build/vendor.js:204804:19)
    at new PouchDB$3 (file:///android_asset/www/build/vendor.js:191679:36)
    at PouchService.webpackJsonp.23.PouchService.register (file:///android_asset/www/build/main.js:4381:76)
    at UsuarioService.webpackJsonp.16.UsuarioService.startConnection (file:///android_asset/www/build/main.js:3262:45)
    at file:///android_asset/www/build/main.js:2454:50
    at t.invoke (file:///android_asset/www/build/polyfills.js:3:9283)
    at Object.onInvoke (file:///android_asset/www/build/vendor.js:4509:37)
    at t.invoke (file:///android_asset/www/build/polyfills.js:3:9223)
    at r.run (file:///android_asset/www/build/polyfills.js:3:4452)
    at file:///android_asset/www/build/polyfills.js:3:14076
    at t.invokeTask (file:///android_asset/www/build/polyfills.js:3:9967)
    at Object.onInvokeTask (file:///android_asset/www/build/vendor.js:4500:37)
    at t.invokeTask (file:///android_asset/www/build/polyfills.js:3:9888)
    at r.runTask (file:///android_asset/www/build/polyfills.js:3:5143)
    at o (file:///android_asset/www/build/polyfills.js:3:2203)
    console.(anonymous function) @ vendor.js:209710
     vendor.js:209710

image

import * as PouchDB from 'pouchdb-browser';

PouchDB.plugin(require('pouchdb-adapter-cordova-sqlite'));

Everybody posting here: Please include information since when it doesn’t work any more and what you did before.

That is strange - I get the same issue if I try

import PouchDB from 'pouchdb'

The change I made was to upgrade the projects version of Ionic to the latest, and the same for pouchdb. However I have rolled back the changes to a previous working version and still have this issue.

Did you also reset the node_module folder?
What exactly were the changes in your package.json during the update? only ionic-angular?

Same issue here after upgrading ionic application to use latest ionic-cli and packages.
All works ok when running against browser platform

When running app on Android emulator, I get a a blank screen and log says:

D/SystemWebChromeClient: file:///android_asset/www/build/polyfills.js: Line 3 : Error: Uncaught (in promise): TypeError: WebSqlPouchCore.call is not a function
                                                                      TypeError: WebSqlPouchCore.call is not a function
                                                                          at PouchDB$5.CordovaSQLitePouch (file:///android_asset/www/build/vendor.js:125751:19)
                                                                          at new PouchDB$5 (file:///android_asset/www/build/vendor.js:115804:36)
                                                                          at new BaseRepository (file:///android_asset/www/build/main.js:1880:19)
                                                                          at new SettingService (file:///android_asset/www/build/main.js:1609:28)
                                                                          at _createClass (file:///android_asset/www/build/vendor.js:9883:26)
                                                                          at _createProviderInstance$1 (file:///android_asset/www/build/vendor.js:9841:26)
                                                                          at initNgModule (file:///android_asset/www/build/vendor.js:9795:13)
                                                                          at new NgModuleRef_ (file:///android_asset/www/build/vendor.js:10903:9)
                                                                          at createNgModuleRef (file:///android_asset/www/build/vendor.js:10887:12)
                                                                          at Object.debugCreateNgModuleRef [as createNgModuleRef] (file:///android_asset/www/build/vendor.js:13181:12)

I even tried reverting all pouch-db and sqlite related package upgrade to previous working version and still same issue.
So, I would say this may be related to some core lib upgrade… but not sure which one.

Note that in my case, I already had

import PouchDB from 'pouchdb'

mentioned by @keithlenne

Note that earlier, I ran into the missing vendor.js mentioned in https://github.com/ionic-team/ionic2-starter-aws/pull/29

And right after fixing that, I got into this one.

My ionic info is:

global packages:

    @ionic/cli-utils : 1.5.0
    Cordova CLI      : 7.0.1
    Ionic CLI        : 3.5.0

local packages:

    @ionic/app-scripts              : 2.0.2
    @ionic/cli-plugin-cordova       : 1.4.1
    @ionic/cli-plugin-ionic-angular : 1.3.2
    Cordova Platforms               : android 6.2.3 browser 4.1.0
    Ionic Framework                 : ionic-angular 3.5.3

System:

    Node       : v6.11.0
    OS         : Linux 4.8
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 3.10.10

both during the upgrade and the downgrade I removed the node_module folder and the ios folder to ensure nothing was left to chance.

I upgraded from ionic 3.2 to 3.5.3 which includes, app_scripts, the cli angular and ionic.

Working lock file:

Do you know which package is responsible for the bug?

I would guess @ionic/app-scripts as it seems some code is missing that should be there, probably left off during the build process. Can you try older versions like 1.3.12? (Remove the vendor.js from index.html while testing).

Working package.json

{
  "name": "example",
  "scripts": {
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve",
    "release": "ionic cordova build android --release --prod",
    "start": "ionic serve",
    "build": "npm run ionic:build"
  },
  "dependencies": {
    "@angular/common": "4.1.3",
    "@angular/compiler": "4.1.3",
    "@angular/compiler-cli": "4.1.3",
    "@angular/core": "4.1.3",
    "@angular/forms": "4.1.3",
    "@angular/http": "4.1.3",
    "@angular/platform-browser": "4.1.3",
    "@angular/platform-browser-dynamic": "4.1.3",
    "@ionic-native/core": "3.12.1",
    "@ionic-native/splash-screen": "3.12.1",
    "@ionic-native/status-bar": "3.12.1",
    "@ionic/storage": "2.0.1",
    "cordova-android": "6.2.3",
    "cordova-browser": "~4.1.0",
    "cordova-plugin-compat": "1.0.0",
    "cordova-plugin-console": "1.0.7",
    "cordova-plugin-device": "1.1.6",
    "cordova-plugin-file": "4.3.3",
    "cordova-plugin-network-information": "1.3.3",
    "cordova-plugin-splashscreen": "4.0.3",
    "cordova-plugin-statusbar": "2.2.3",
    "cordova-plugin-whitelist": "1.3.2",
    "cordova-sqlite-storage": "2.0.4",
    "ionic-angular": "3.5.2",
    "ionic-plugin-keyboard": "2.2.1",
    "ionicons": "3.0.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",
    "rxjs": "5.4.0",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.12"
  },
  "devDependencies": {
    "@ionic/app-scripts": "2.0.1",
    "@ionic/cli-plugin-cordova": "1.4.0",
    "@ionic/cli-plugin-ionic-angular": "1.3.1",
    "@types/node": "8.0.2",
    "@types/xml2js": "^0.4.0",
    "typescript": "~2.3.4",
    "xml2js": "0.4.17"
  }
}

Would you be willing to upgrade this to 2.0.2 and see if it fails then? Would help to pindown the problem.