Opening an existing sqlite db file

I upgraded from Expo v27 to v32, and my app can no longer open the existing sqlite database file that I use.

In App.js, I have this code

// borrowed from https://forums.expo.dev/t/sqlite-existing-database/6470/4
Expo.FileSystem.downloadAsync(
    Expo.Asset.fromModule(require('./assets/all_words.db')).uri,
    Expo.FileSystem.documentDirectory + 'SQLite/all_words.db'
);

In app.json, I added the following into the “expo” associative array:

"packagerOpts": { "assetExts": ["db"] }

The database file exists on disk:

$ ls assets/all_words.db
assets/all_words.db
$

However, when the code executes, I get this error:

Unable to resolve "./assets/all_words.db" from "App.js"

What’s the correct way to open an existing sqlite db file?

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