SQLite: undefined is not an object


I am having the error undefined not an object while calling SQLite.openDatabase()

I followed the example of SQLite from https://github.com/expo/sqlite-example/blob/master/main.js

My Code:

import Expo, { SQLite } from 'expo';
const dataBase = SQLite.openDatabase({name: 'db.db'});

Error I got:


"dependencies": {
    "@shoutem/theme": "^0.10.0",
    "color": "0.11.3",
    "expo": "15.1.2",
    "get-urls": "^7.0.0",
    "global": "^4.3.2",
    "lodash": "^4.13.1",
    "moment": "2.13.0",
    "native-base": "2.1.0-rc.2",
    "react": "~15.4.0",
    "react-native": "0.42.3",
    "react-native-actionsheet": "^2.2.2",
    "react-native-animatable": "0.6.1",
    "react-native-button": "1.6.0",
    "react-native-collapsible": "^0.9.0",
    "react-native-communications": "^2.2.1",
    "react-native-easy-grid": "0.1.7",
    "react-native-gifted-spinner": "0.0.4",
    "react-native-google-maps-directions": "^1.1.2",
    "react-native-hideable-view": "^1.0.3",
    "react-native-hyperlink": "0.0.11",
    "react-native-lightbox": "0.6.0",
    "react-native-list-popover": "1.0.5",
    "react-native-modalbox": "1.3.4",
    "react-native-router-flux": "*",
    "react-native-scrollable-tab-view": "0.7.2",
    "react-native-search-bar": "3.0.0",
    "react-native-simple-modal": "3.0.4",
    "react-native-slide-down-panel": "1.0.6",
    "react-native-swiper": "1.5.4",
    "react-native-vector-icons": "^4.3.0",
    "react-redux": "^4.4.5",
    "redux": "^3.5.2",
    "redux-persist": "^3.2.2",
    "redux-thunk": "^2.1.0",
    "remote-redux-devtools": "^0.3.3",
    "remote-redux-devtools-on-debugger": "^0.4.6",
    "yarn": "^1.0.2"

Please help!.

Looking at your package.json, you’re using quite an old version of Expo (15.1.2). I believe SQLite was added in SDK 16 (there is no page for it in the SDK 15 docs).

I recommend periodically upgrading to the latest version of Expo since we regularly test the latest version and drop old versions after several months (usually about half a year).

Hi ide,

Thank you. I got it.


I update the expo to version 16.0.0. Now I can execute openDatabase and got the response. But when I execute the transaction, I got the issue

undefined is not a object (evaluating ‘ExponentSQLite.exec’)


import Expo, { SQLite } from 'expo';
const db = SQLite.openDatabase({ name: 'db.db' });

class PurchaseHistory extends Component {
     db.transaction(tx => {
                "create table if not exists purchasehistory (id integer primary key not null, receiptnumber text)"



What is sdkVersion in your app.json or exp.json? Make sure to clear your node_modules/ directory and reinstall and restart your packager too before you re-launch your app after switching versions.

Hi nikki,

The sdkVersion version was the old one 15.0.0 in my app.json. Now I changed to 16.0.0 and it is working.
Thank you for the help.

1 Like