-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Before opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
React Native
Amplify APIs
DataStore, GraphQL API, Authentication, Storage
Amplify Version
v6
Amplify Categories
storage, api
Backend
Amplify CLI
Environment information
System:
OS: Linux 6.15 Arch Linux
CPU: (16) x64 AMD Ryzen 9 6900HS with Radeon Graphics
Memory: 27.06 GB / 38.40 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 18.16.1 - ~/.nvm/versions/node/v18.16.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.16.1/bin/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.1/bin/npm
Browsers:
Firefox: 141.0
npmGlobalPackages:
@aws-amplify/cli: 13.0.1
@githubnext/github-copilot-cli: 0.1.36
@google/gemini-cli: 0.1.9
@sitespeed.io/throttle: 5.0.1
amplify-cli: 1.0.0
corepack: 0.17.0
eas-cli: 16.12.0
graphql-language-service-cli: 3.3.33
npm: 9.5.1
prettier: 3.5.3
react-js-to-ts: 1.4.0
serve: 14.2.4
yo: 5.0.0
Describe the bug
I have an Expo app set up with DataStore configured to use the expo sqlite adapter. It was while investigating another issue (#13269) that I realised there was no AmplifyDatastore database being created in the app data directory. Instead it was falling back to asyncstorage. I verified this by reading RKStorage and seeing entries for DataStore.
There was no error message or indication that it wasn't using sqlite in the logs when debug logging was enabled. Although I might have been grepping for the wrong terms.
Instead I followed the instructions to use react-native-sqlite-storage and it is now creating the AmplifyDatastore database. It also has fixed the issue 13269 as mentioned above.
Expected behavior
When using the Expo sqlite adapter I expect it to use sqlite and not asyncstorage.
Reproduction steps
I wasn't able to make a minimal reproduction with a new amplify and expo project as I was coming across unrelated blockers. However I can share some commits that show what I've done on my own project to change from the expo adapter to the react native one.
These are the relevant entries in package.json
"@aws-amplify/datastore-storage-adapter": "^2.0.42",
"@aws-amplify/ui-react-native": "^1.2.20",
"aws-amplify": "^5.3.11",
Code Snippet
Change in packages: platelet-app/platelet-mobile@95f4a29
Change in DataStore.configure: platelet-app/platelet-mobile@f7039a7
I'm also using this function to clean up old data in asyncstorage that shouldn't be there: platelet-app/platelet-mobile@9c12ce4
I didn't merge these changes to master yet so this is the repository still with broken expo adapter: https://github.com/platelet-app/platelet-mobile
Log output
I tried to include it, but GitHub says it's too long.
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
Android emulator, iPhone 16
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
{
"name": "mobile",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"test": "jest --watch --testTimeout=60000",
"test:ci": "jest --testTimeout=60000",
"test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --testTimeout=100000000"
},
"dependencies": {
"@aws-amplify/datastore-storage-adapter": "^2.0.42",
"@aws-amplify/ui-react-native": "^1.2.20",
"@azure/core-asynciterator-polyfill": "^1.0.2",
"@expo/metro-runtime": "~4.0.1",
"@react-native-async-storage/async-storage": "1.23.1",
"@react-native-community/netinfo": "11.4.1",
"@react-native/gradle-plugin": "^0.72.11",
"@react-navigation/bottom-tabs": "^6.5.8",
"@react-navigation/material-bottom-tabs": "^6.2.16",
"@react-navigation/native-stack": "^6.9.13",
"@reduxjs/toolkit": "^1.9.5",
"@sentry/react-native": "~6.10.0",
"amazon-cognito-identity-js": "^6.3.1",
"aws-amplify": "^5.3.11",
"core-js": "^3.31.1",
"expo": "~52.0.47",
"expo-dev-client": "~5.0.20",
"expo-file-system": "~18.0.12",
"expo-splash-screen": "~0.29.24",
"expo-status-bar": "~2.0.1",
"expo-updates": "~0.27.4",
"faker": "5.5.3",
"moment": "^2.29.4",
"moment-timezone": "^0.5.43",
"promise": "^8.3.0",
"react": "18.3.1",
"react-content-loader": "^6.2.1",
"react-native": "0.76.9",
"react-native-get-random-values": "~1.11.0",
"react-native-paper": "^5.14.5",
"react-native-paper-dates": "^0.18.12",
"react-native-safe-area-context": "4.12.0",
"react-native-screens": "~4.4.0",
"react-native-sqlite-storage": "^6.0.1",
"react-native-svg": "15.8.0",
"react-native-url-polyfill": "^2.0.0",
"react-redux": "^8.1.1",
"redux-saga": "^1.2.3"
},
"devDependencies": {
"@babel/core": "^7.24.0",
"@testing-library/jest-native": "^5.4.2",
"@testing-library/react-native": "^12.1.3",
"@types/jest": "^29.5.11",
"@types/lodash": "^4.14.202",
"@types/react": "~18.3.12",
"jest-expo": "~52.0.6",
"mock-async-storage": "^2.2.0",
"typescript": "~5.3.3"
},
"private": true,
"description": "Mobile version of Platelet",
"repository": {
"type": "git",
"url": "git+https://github.com/platelet-app/platelet-mobile.git"
},
"author": "Theo Cranmore",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/platelet-app/platelet-mobile/issues"
},
"homepage": "https://github.com/platelet-app/platelet-mobile#readme"
}