electric-sql / electric

Sync little subsets of your Postgres data into local apps and services.
https://electric-sql.com
Apache License 2.0
6.12k stars 143 forks source link

Cannot read properties of undefined (reading 'numTables') thrown during electrification of Capacitor adapter #756

Closed ccapndave closed 9 months ago

ccapndave commented 9 months ago

After updating to Electric 0.8, we get this error during the call to electrify (using the Capacitor plugin):

process.js:7 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'numTables')
    at he._verifyTableStructure (process.js:7:19)
    at async he.start (process.js:1:2393)
    at async b7.startProcess (registry.js:1:1777)
    at async T6 (index.js:1:611)
    at async h5 (index.js:1:245)
    at async makeElectric (database.ts:80:10)
    at async initDatabases (database.ts:94:20)
    at async init (main.tsx:24:15)
_verifyTableStructure @ process.js:7
gregzo commented 9 months ago

I see the problem.

I've misunderstood the documentation for Capacitor SQLite's run method: <!DOCTYPE html> values any[] values when RETURNING

The adapter's exec() method should instead map to Cap-SQLite's query() method.

I'll make a PR shortly.

kevin-dp commented 9 months ago

I'm closing this as we've merged https://github.com/electric-sql/electric/pull/760 which addresses this issue.