amplify-js: DataStore is not starting

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

DataStore

Amplify Categories

storage

Environment information

# Put output below this line
  System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1 Pro
    Memory: 94.16 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 17.8.0 - /opt/homebrew/bin/node
    Yarn: 1.22.17 - /opt/homebrew/bin/yarn
    npm: 8.5.5 - /opt/homebrew/bin/npm
    Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 102.0.5005.115
    Safari: 15.5
  npmPackages:
    @babel/core: ^7.12.9 => 7.18.2 
    @babel/runtime: ^7.12.5 => 7.18.3 
    @react-native-async-storage/async-storage: ^1.17.6 => 1.17.6 
    @react-native-community/eslint-config: ^2.0.0 => 2.0.0 
    @react-native-community/netinfo: ^9.0.0 => 9.0.0 
    @react-native-masked-view/masked-view: ^0.2.6 => 0.2.6 
    @react-native-picker/picker: ^2.4.1 => 2.4.1 
    @react-navigation/native: ^6.0.10 => 6.0.10 
    @react-navigation/native-stack: ^6.6.2 => 6.6.2 
    @react-navigation/stack: ^6.2.1 => 6.2.1 
    @reduxjs/toolkit: ^1.8.2 => 1.8.2 
    @reduxjs/toolkit-query:  1.0.0 
    @reduxjs/toolkit-query-react:  1.0.0 
    HelloWorld:  0.0.1 
    amazon-cognito-identity-js: ^5.2.9 => 5.2.9 
    aws-amplify: ^4.3.24 => 4.3.24 
    aws-amplify-react-native: ^6.0.4 => 6.0.4 
    babel-jest: ^26.6.3 => 26.6.3 
    babel-plugin-module-resolver: ^4.1.0 => 4.1.0 
    babel-plugin-transform-remove-console: ^6.9.4 => 6.9.4 
    eslint: ^7.32.0 => 7.32.0 
    formik: ^2.2.9 => 2.2.9 
    hermes-inspector-msggen:  1.0.0 
    jest: ^26.6.3 => 26.6.3 
    metro-config: ^0.71.0 => 0.71.0 (0.67.0)
    metro-react-native-babel-preset: ^0.71.0 => 0.71.0 (0.67.0)
    prop-types: ^15.8.1 => 15.8.1 
    react: 17.0.2 => 17.0.2 
    react-dom: 17.0.2 => 17.0.2 
    react-native: 0.68.2 => 0.68.2 
    react-native-gesture-handler: ^2.4.2 => 2.4.2 
    react-native-reanimated: ^2.8.0 => 2.8.0 
    react-native-safe-area-context: ^4.3.1 => 4.3.1 
    react-native-screens: ^3.13.1 => 3.13.1 
    react-redux: ^8.0.2 => 8.0.2 
    react-test-renderer: 17.0.2 => 17.0.2 
    redux: ^4.2.0 => 4.2.0 
    redux-actions: ^2.6.5 => 2.6.5 
    redux-promise-middleware: ^6.1.2 => 6.1.2 
    redux-thunk: ^2.4.1 => 2.4.1 
    yup: ^0.32.11 => 0.32.11 
    yup-password: ^0.2.2 => 0.2.2 
  npmGlobalPackages:
    @aws-amplify/cli: 8.4.0
    firebase-tools: 10.9.2
    ios-deploy: 1.11.4
    near-cli: 3.3.0
    npm-check-updates: 12.2.1
    npm: 8.5.5
    react-devtools: 4.24.7
    yarn: 1.22.17


Describe the bug

I followed this manual: https://docs.amplify.aws/start/getting-started/installation/q/integration/react-native/#option-2-follow-the-instructions Amplify was installed but I have a problem with reading the data. It keeps loading, in the example below the second console log is not executing:

console.log('Start');
const posts = await DataStore.query(Post);
console.log('End');

Then I enabled logging and it looks like DataService can’t start:

LOG  [INFO] 21:02.403 DataStore - DataStore Init models
LOG  [INFO] 21:02.404 DataStore - DataStore Models initialized
LOG  [DEBUG] 21:02.408 DataStore - Starting DataStore
LOG  [DEBUG] 21:02.409 DataStore - Starting Storage

Expected behavior

DataStore started, able to read the data.

Reproduction steps

  1. Follow the tutorial: https://docs.amplify.aws/start/getting-started/installation/q/integration/react-native/#option-2-follow-the-instructions
  2. Try to read the data from DB

Code Snippet

// Put your code below this line.
import awsconfig from './src/aws-exports';
Amplify.Logger.LOG_LEVEL = 'DEBUG';

Amplify.configure(awsconfig);

Log output

// Put your logs below this line
 LOG  [DEBUG] 21:02.401 Amplify - component registered in amplify {"amplifyConfig": {}, "clear": [Function clear], "configure": [Function anonymous], "delete": [Function anonymous], "observe": [Function anonymous], "observeQuery": [Function anonymous], "query": [Function anonymous], "save": [Function anonymous], "setConflictHandler": [Function anonymous], "setErrorHandler": [Function anonymous], "start": [Function anonymous], "stop": [Function stop], "syncPredicates": WeakMap {}}
 LOG  [INFO] 21:02.403 DataStore - validating schema {"schema": {"enums": {}, "models": {"User": [Object]}, "nonModels": {}, "version": "82a003ac64f504cd2b49d6ed73b8a5bc"}}
 LOG  [INFO] 21:02.403 DataStore - DataStore Init models
 LOG  [INFO] 21:02.404 DataStore - DataStore Models initialized
 LOG  [DEBUG] 21:02.408 DataStore - Starting DataStore
 LOG  [DEBUG] 21:02.409 DataStore - Starting Storage


aws-exports.js

/* eslint-disable */
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.

const awsmobile = {
    "aws_project_region": "us-east-2",
    "aws_appsync_graphqlEndpoint": "https://*.appsync-api.us-east-2.amazonaws.com/graphql",
    "aws_appsync_region": "us-east-2",
    "aws_appsync_authenticationType": "API_KEY",
    "aws_appsync_apiKey": "",
    "aws_cognito_identity_pool_id": "",
    "aws_cognito_region": "us-east-2",
    "aws_user_pools_id": "us-east",
    "aws_user_pools_web_client_id": "",
    "oauth": {},
    "aws_cognito_username_attributes": [
        "EMAIL"
    ],
    "aws_cognito_social_providers": [],
    "aws_cognito_signup_attributes": [],
    "aws_cognito_mfa_configuration": "OPTIONAL",
    "aws_cognito_mfa_types": [
        "SMS",
        "TOTP"
    ],
    "aws_cognito_password_protection_settings": {
        "passwordPolicyMinLength": 8,
        "passwordPolicyCharacters": [
            "REQUIRES_LOWERCASE",
            "REQUIRES_NUMBERS",
            "REQUIRES_SYMBOLS",
            "REQUIRES_UPPERCASE"
        ]
    },
    "aws_cognito_verification_mechanisms": [
        "EMAIL"
    ]
};


export default awsmobile;

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (7 by maintainers)

Most upvoted comments

@chrisbonifacio I don’t see any requests to App Sync.

@chrisbonifacio

  1. I have only one record
  2. I see Disable conflict detection
  3. Yes, I deployed it first and then run pull

I will check the network requests soon.

GraphQL schema

export const schema = {
    "models": {
        "User": {
            "name": "User",
            "fields": {
                "id": {
                    "name": "id",
                    "isArray": false,
                    "type": "ID",
                    "isRequired": true,
                    "attributes": []
                },
                "untitledfield": {
                    "name": "untitledfield",
                    "isArray": false,
                    "type": "String",
                    "isRequired": false,
                    "attributes": []
                },
                "createdAt": {
                    "name": "createdAt",
                    "isArray": false,
                    "type": "AWSDateTime",
                    "isRequired": false,
                    "attributes": [],
                    "isReadOnly": true
                },
                "updatedAt": {
                    "name": "updatedAt",
                    "isArray": false,
                    "type": "AWSDateTime",
                    "isRequired": false,
                    "attributes": [],
                    "isReadOnly": true
                }
            },
            "syncable": true,
            "pluralName": "Users",
            "attributes": [
                {
                    "type": "model",
                    "properties": {}
                },
                {
                    "type": "auth",
                    "properties": {
                        "rules": [
                            {
                                "allow": "public",
                                "operations": [
                                    "create",
                                    "update",
                                    "delete",
                                    "read"
                                ]
                            }
                        ]
                    }
                }
            ]
        }
    },
    "enums": {},
    "nonModels": {},
    "version": "82a003ac64f504cd2b49d6ed73b8a5bc"
};