Illegal invocation using SQLite in web

I’ve created a new project and added the following:

import { SQLite } from 'expo-sqlite';

export const db = SQLite.openDatabase("db.db");

When run expo start and press w to test in a browser I get a “TypeError: Illegal invocation” error.

any luck with this? I get the same error

Nope, just worked around it by modifying existing projects that didn’t throw the error.

So were you able to get sqlite working on web?

Yes, by forking a working sql lite project.

I found this text: Using SQLite in Expo for Offline React Native Apps | by Forbes Lindesay | ITNEXT

The expo-sqlite module provides an SQL database with a WebSQL based interface. This is pretty powerful, and supports pretty much all the features of SQLite. SQLite is also perfect for exactly the kind of use case that apps with offline requirements have. It lets you store large amounts of structured data on disk and read only the parts you need for displaying the current screen into memory.

Unfortunately, while SQLite has a decent API, the WebSQL API is so bad it was ultimately abandoned as a standard for the web. Fortunately @databases/expo wraps that WebSQL API up into something more useable.

Hi. Having the same error. Can you provide a link to that working sql lite project? Thanks!

I get the same error

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.