Skip to content

Unable to access database user from my local server in the remote server: LOG {"ACTIVITY_NULL": 4, "PERMISSION_DENIED": 1, "POSITION_UNAVAILABLE": 2, "TIMEOUT": 3, "code": 3, "message": "Location request timed out"} #13118

Open
@elkee2003

Description

@elkee2003

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication, GraphQL API, DataStore, Storage

Amplify Version

v6

Amplify Categories

auth, storage, api

Backend

Amplify CLI

Environment information

# Put output below this line
ystem:
    OS: Windows 11 10.0.22000
    CPU: (4) x64 Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
    Memory: 1.59 GB / 7.88 GB
  Binaries:
    Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
    npm: 9.8.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (122.0.2365.80)        
    Internet Explorer: 11.0.22000.120
  npmPackages:
    @aws-amplify/react-native: ^1.0.17 => 1.0.17
    @aws-amplify/rtn-web-browser: ^1.0.16 => 1.0.16
    @aws-amplify/ui-react-native: ^2.1.2 => 2.1.2
    @babel/core: ^7.20.0 => 7.23.9
    @babel/preset-env: ^7.20.0 => 7.23.9
    @babel/runtime: ^7.20.0 => 7.23.9
    @react-native-async-storage/async-storage: ^1.22.0 => 1.22.0    
    @react-native-community/geolocation: ^3.1.0 => 3.1.0
    @react-native-community/netinfo: ^11.3.0 => 11.3.0
    @react-native-masked-view/masked-view: ^0.3.1 => 0.3.1
    @react-native/babel-preset: 0.73.21 => 0.73.21
    @react-native/eslint-config: 0.73.2 => 0.73.2
    @react-native/metro-config: 0.73.5 => 0.73.5
    @react-native/typescript-config: 0.73.1 => 0.73.1
    @react-navigation/drawer: ^6.6.7 => 6.6.7
    @react-navigation/native: ^6.1.10 => 6.1.10
    @react-navigation/stack: ^6.3.21 => 6.3.21
    @types/react: ^18.2.6 => 18.2.55
    @types/react-test-renderer: ^18.0.0 => 18.0.7
    HelloWorld:  0.0.1
    aws-amplify: ^6.0.17 => 6.0.17
    aws-amplify/adapter-core:  undefined ()
    aws-amplify/analytics:  undefined ()
    aws-amplify/analytics/kinesis:  undefined ()
    aws-amplify/analytics/kinesis-firehose:  undefined ()
    aws-amplify/analytics/personalize:  undefined ()
    aws-amplify/analytics/pinpoint:  undefined ()
    aws-amplify/api:  undefined ()
    aws-amplify/api/server:  undefined ()
    aws-amplify/auth:  undefined ()
    aws-amplify/auth/cognito:  undefined ()
    aws-amplify/auth/cognito/server:  undefined ()
    aws-amplify/auth/enable-oauth-listener:  undefined ()
    aws-amplify/auth/server:  undefined ()
    aws-amplify/datastore:  undefined ()
    aws-amplify/in-app-messaging:  undefined ()
    aws-amplify/in-app-messaging/pinpoint:  undefined ()
    aws-amplify/push-notifications:  undefined ()
    aws-amplify/push-notifications/pinpoint:  undefined ()
    aws-amplify/storage:  undefined ()
    aws-amplify/storage/s3:  undefined ()
    aws-amplify/storage/s3/server:  undefined ()
    aws-amplify/storage/server:  undefined ()
    aws-amplify/utils:  undefined ()
    babel-jest: ^29.6.3 => 29.7.0
    eslint: ^8.19.0 => 8.56.0
    geolocationexample:  0.0.0
    jest: ^29.6.3 => 29.7.0
    prettier: 2.8.8 => 2.8.8
    react: 18.2.0 => 18.2.0
    react-native: 0.73.4 => 0.73.4
    react-native-gesture-handler: ^2.15.0 => 2.15.0
    react-native-get-random-values: ^1.10.0 => 1.10.0
    react-native-google-places-autocomplete: ^2.5.6 => 2.5.6        
    react-native-maps: ^1.10.2 => 1.10.2
    react-native-maps-directions: ^1.9.0 => 1.9.0
    react-native-permissions: ^4.1.1 => 4.1.1
    react-native-reanimated: ^3.7.0 => 3.7.0
    react-native-safe-area-context: ^4.9.0 => 4.9.0
    react-native-screens: ^3.29.0 => 3.29.0
    react-native-url-polyfill: ^2.0.0 => 2.0.0
    react-native-vector-icons: ^10.0.3 => 10.0.3
    react-test-renderer: 18.2.0 => 18.2.0
    typescript: 5.0.4 => 5.0.4
  npmGlobalPackages:
    @aws-amplify/cli: 12.10.1
    npm: 9.8.1

npm notice 
npm notice New major version of npm available! 9.8.1 -> 10.5.0      
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.5.0
npm notice Run npm install -g [email protected] to update!
npm notice

Describe the bug

When I create a user, I am unable to see the user, in other words, when the app loads it does not access the user, even when I console.log:

import { createContext, useState,useEffect, useContext } from "react";
import { confirmResetPassword, getCurrentUser } from 'aws-amplify/auth';
import { DataStore, Predicates } from 'aws-amplify/datastore';
import { User } from "../models";
// import {Auth, Amplify, Predicates} from 'aws-amplify';
// import { getCurrentUser, AuthUser } from 'aws-amplify/auth';
// import { DataStore, AuthModeStrategyType } from 'aws-amplify/datastore';

const AuthContext = createContext({})
const AuthContextProvider = ({children})=>{

    const [authUser, setAuthUser] = useState(null)
    const [dbUser, setDbUser] = useState(null)
    const sub = authUser?.userId;

    // This is one method to use 'await'
    // const fetchUser = async ()=>{
    //     try{
    //         const res = await getCurrentUser()
    //         console.log(authUser)   
    //         console.log('checking if this is authUser:', authUser) 
    //     }catch(err){
    //         console.log('This is the error',err)
    //     }
        
    // }

    // useEffect(()=>{
    //     fetchUser()
    //     // getCurrentUser().then((res)=>setAuthUser(res))
    //     // console.log("this is authUser:", authUser)
    //     // console.log('this is sub:', sub)
    // },[]);

     useEffect(() => {
        getCurrentUser().then((res) => {
            setAuthUser(res);
            console.log('Updated authUser:', res);
            console.log('This is sub:',sub)
        }).catch((err) => {
            console.log('Error fetching current user:', err);
        });
    }, []);


    // useEffect(()=>{
    //     DataStore.query(User, (user)=>user.sub.eq(sub)).then((users)=>setDbUser(users[0]))
    //     console.log(dbUser)
    //     console.log('checking if this is dbUser:', dbUser)
    //     // Amplify.Logger.LOG_LEVEL = "DEBUG";
    //     // DataStore.observeQuery(User)
    //     // DataStore.delete(User, Predicates.ALL)
    //     // DataStore.clear()
    // }, [sub])
    useEffect(() => {
        if (sub) {
            DataStore.query(User, (user) => user.sub.eq(sub)).then((users) => {
                setDbUser(users[0]);
                console.log('Updated dbUser:', users[0]);
                console.log('this is dbuser',dbUser)
                // Amplify.Logger.LOG_LEVEL = "DEBUG";
                // DataStore.observeQuery(User)
                // DataStore.delete(User, Predicates.ALL)
                // DataStore.clear()
            }).catch((error) => {
                console.log('Error fetching dbUser:', error);
            });
            console.log('see sub and dbuser:', sub,'dbusernkor:', dbUser)
        }
    }, [sub]);


    // This useEffect is for if I want to do things online only ie, I can delete things in the amplify studio and it will delete locally

    // useEffect(() => {
    //     const subscription = DataStore.observeQuery(
    //         User,
    //         user => user.sub.eq(sub)
    //     ).subscribe(snapshot => {
    //         const { items, isSynced } = snapshot;
    //         console.log(`[Snapshot] item count: ${items.length}, isSynced: ${isSynced}`);
    //         if (items[0]) {
    //             setDbUser(items[0])
    //         }
    //     });

    //     return () => {
    //         subscription.unsubscribe()
    //     }
    // }, [sub])
    // console.log("DB USER: ", dbUser)

    return(
        <AuthContext.Provider value={{authUser, dbUser, sub, setDbUser }}>
            {children}
        </AuthContext.Provider>
    )
}

export default AuthContextProvider;

export const useAuthContext = ()=> useContext(AuthContext)

I can see auth user and sub, but not dbuser

Expected behavior

It is meant to show me the dbuser created but it doesn't. I am unable to access the dbuser, sometimes if, it shows and I update it from my local server, it doesn't show in the remote server (amplify studio).

Reproduction steps

  1. I write this code:
import { createContext, useState,useEffect, useContext } from "react";
import { confirmResetPassword, getCurrentUser } from 'aws-amplify/auth';
import { DataStore, Predicates } from 'aws-amplify/datastore';
import { User } from "../models";
// import {Auth, Amplify, Predicates} from 'aws-amplify';
// import { getCurrentUser, AuthUser } from 'aws-amplify/auth';
// import { DataStore, AuthModeStrategyType } from 'aws-amplify/datastore';

const AuthContext = createContext({})

const AuthContextProvider = ({children})=>{

    const [authUser, setAuthUser] = useState(null)
    const [dbUser, setDbUser] = useState(null)
    const sub = authUser?.userId;

    // This is one method to use 'await'
    // const fetchUser = async ()=>{
    //     try{
    //         const res = await getCurrentUser()
    //         console.log(authUser)   
    //         console.log('checking if this is authUser:', authUser) 
    //     }catch(err){
    //         console.log('This is the error',err)
    //     }
        
    // }

    // useEffect(()=>{
    //     fetchUser()
    //     // getCurrentUser().then((res)=>setAuthUser(res))
    //     // console.log("this is authUser:", authUser)
    //     // console.log('this is sub:', sub)
    // },[]);

     useEffect(() => {
        getCurrentUser().then((res) => {
            setAuthUser(res);
            console.log('Updated authUser:', res);
            console.log('This is sub:',sub)
        }).catch((err) => {
            console.log('Error fetching current user:', err);
        });
    }, []);


    // useEffect(()=>{
    //     DataStore.query(User, (user)=>user.sub.eq(sub)).then((users)=>setDbUser(users[0]))
    //     console.log(dbUser)
    //     console.log('checking if this is dbUser:', dbUser)
    //     // Amplify.Logger.LOG_LEVEL = "DEBUG";
    //     // DataStore.observeQuery(User)
    //     // DataStore.delete(User, Predicates.ALL)
    //     // DataStore.clear()
    // }, [sub])
    useEffect(() => {
        if (sub) {
            DataStore.query(User, (user) => user.sub.eq(sub)).then((users) => {
                setDbUser(users[0]);
                console.log('Updated dbUser:', users[0]);
                console.log('this is dbuser',dbUser)
                // Amplify.Logger.LOG_LEVEL = "DEBUG";
                // DataStore.observeQuery(User)
                // DataStore.delete(User, Predicates.ALL)
                // DataStore.clear()
            }).catch((error) => {
                console.log('Error fetching dbUser:', error);
            });
            console.log('see sub and dbuser:', sub,'dbusernkor:', dbUser)
        }
    }, [sub]);


    // This useEffect is for if I want to do things online only ie, I can delete things in the amplify studio and it will delete locally

    // useEffect(() => {
    //     const subscription = DataStore.observeQuery(
    //         User,
    //         user => user.sub.eq(sub)
    //     ).subscribe(snapshot => {
    //         const { items, isSynced } = snapshot;
    //         console.log(`[Snapshot] item count: ${items.length}, isSynced: ${isSynced}`);
    //         if (items[0]) {
    //             setDbUser(items[0])
    //         }
    //     });

    //     return () => {
    //         subscription.unsubscribe()
    //     }
    // }, [sub])
    // console.log("DB USER: ", dbUser)

    return(
        <AuthContext.Provider value={{authUser, dbUser, sub, setDbUser }}>
            {children}
        </AuthContext.Provider>
    )
}

export default AuthContextProvider;

export const useAuthContext = ()=> useContext(AuthContext)

in one folder. note that I have wrapped by main component with AuthContextProvider

  1. I try to create it here:
// import '@azure/core-asynciterator-polyfill'
import { View, Text, TextInput, Button, Pressable, Alert } from 'react-native'
import React, {useEffect, useState, } from 'react'
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';
import styles from './styles'
import { useAuthContext } from '../../contexts/AuthContext'
import { useNavigation } from '@react-navigation/native'
import { signOut } from 'aws-amplify/auth';
import { DataStore } from 'aws-amplify/datastore';
import {User} from '../../models'


const ProfileScreen = () => {

  const {sub, dbUser, setDbUser} = useAuthContext()

  const handleSignOut = async()=> {
    try {
      await signOut();
    } catch (error) {
      console.log('error signing out: ', error);
    }
  }
  
    const [name, setName] = useState(dbUser?.name || "")
    const [address, setAddress] = useState(dbUser?.address || "")
    const [phoneNumber, setPhoneNumber]= useState(dbUser?.phoneNumber || "")
    const [lat, setLat] = useState(dbUser?.lat.toString() || "0")
    const [lng, setLng] = useState (dbUser?.lng.toString() || "0") 
    
    const [isFocused, setIsFocused] = useState(false);
   
    const navigation = useNavigation()



    // Start of Function to Create and Update User

    const createUser = async ()=>{
      try{
        const user = await DataStore.save(new User({
         name, 
         address,
         phoneNumber,
         lat:parseFloat(lat), 
         lng:parseFloat(lng), 
         sub
       })
       );
       console.log("I am User:",user)
       setDbUser(user)
     }catch(e){
       Alert.alert("Error", e.message)
     }
    }

    const updateUser= async ()=>{
      const user = await DataStore.save(User.copyOf(dbUser, (updated)=>{
        updated.name = name;
        updated.address = address;
        updated.phoneNumber = phoneNumber
        updated.lat = parseFloat(lat);
        updated.lng = parseFloat(lng);
      }))
      setDbUser(user)
    }
    // End Of Function to Create and Update User

    // Function to Save Data
    const onSave= async()=>{
      if(dbUser){
        await updateUser()
        navigation.goBack()
      }else{
        await createUser()
        navigation.navigate('HomeScreen')
      }
      // navigation.goBack()
    }

    // function to handle focus
    const handleFocusChange = (focused) => {
      setIsFocused(focused);
    };

    // Start Of GooglePlacesAutoComplete
    const handlePlaceSelect = (data, details = null) => {
      // Extract the address from the selected place
      const selectedAddress = data?.description || details?.formatted_address;

      const selectedAddylat = JSON.stringify(details?.geometry?.location.lat) 

      const selectedAddylng = JSON.stringify(details?.geometry?.location.lng) 

      console.log(selectedAddylng, selectedAddylat)
  
      // Update the address state
      setAddress(selectedAddress);
      setLat(selectedAddylat)
      setLng(selectedAddylng)
  
    };
    // End Of GooglePlacesAutoComplete

    return (
    <View style={styles.container}>

      <Text style={styles.title}>Profile</Text>

      <TextInput 
      value={name}
      onChangeText={setName}
      placeholder='Name'
      style={styles.input}
      />

      <TextInput 
      value={address}
      placeholder='Address'
      style={{...styles.input, color: '#04df04'}}
      />

      <View style={isFocused ? styles.gContainerFocused : styles.gContainer}>
        <GooglePlacesAutocomplete
        fetchDetails
        placeholder='Select Address From Here'
        onPress={handlePlaceSelect}
        textInputProps={{
          onFocus:() => handleFocusChange(true),
          onBlur:() => handleFocusChange(false)
        }} 
        styles={{
          textInput:styles.gTextInput,
          textInputContainer:styles.gTextInputContainer,
          listView:styles.glistView,
          poweredContainer:styles.gPoweredContainer
        }}
        query={{
          key: 'key-value',
          language: 'en',
        }}
        />
      </View>

    {/* TextInputs that will be below GooglePlacesAutocomplete */}
    
      <TextInput
      value={phoneNumber}
      onChangeText={setPhoneNumber}
      placeholder='Phone Number'
      style={styles.input}
      />

      <TextInput 
      value={lat}
      placeholder='Latitude'
      style={styles.input}
      />

      <TextInput 
      value={lng}
      placeholder='Longitude'
      style={styles.input}
      />

      <View style={styles.scrnBtn}>
        {/* Save */}
        <Pressable onPress={onSave} style={styles.saveBackground}>
          <Text style={styles.save}>
            Save
          </Text>
        </Pressable>
        
        {/* SignOut */}
        <Pressable onPress={handleSignOut} >
          <Text style={styles.signOut}>
            Sign out
          </Text>
        </Pressable>
      </View>
      
    </View>
  )
}

export default ProfileScreen
  1. When I save for new user, and refresh, It doesn't console. log the database user

Code Snippet

// Put your code below this line.
this is for authcontext:
`import { createContext, useState,useEffect, useContext } from "react";
import { confirmResetPassword, getCurrentUser } from 'aws-amplify/auth';
import { DataStore, Predicates } from 'aws-amplify/datastore';
import { User } from "../models";
// import {Auth, Amplify, Predicates} from 'aws-amplify';
// import { getCurrentUser, AuthUser } from 'aws-amplify/auth';
// import { DataStore, AuthModeStrategyType } from 'aws-amplify/datastore';
  

const AuthContext = createContext({})

const AuthContextProvider = ({children})=>{

    const [authUser, setAuthUser] = useState(null)
    const [dbUser, setDbUser] = useState(null)
    const sub = authUser?.userId;

    // This is one method to use 'await'
    // const fetchUser = async ()=>{
    //     try{
    //         const res = await getCurrentUser()
    //         console.log(authUser)   
    //         console.log('checking if this is authUser:', authUser) 
    //     }catch(err){
    //         console.log('This is the error',err)
    //     }
        
    // }

    // useEffect(()=>{
    //     fetchUser()
    //     // getCurrentUser().then((res)=>setAuthUser(res))
    //     // console.log("this is authUser:", authUser)
    //     // console.log('this is sub:', sub)
    // },[]);

     useEffect(() => {
        getCurrentUser().then((res) => {
            setAuthUser(res);
            console.log('Updated authUser:', res);
            console.log('This is sub:',sub)
        }).catch((err) => {
            console.log('Error fetching current user:', err);
        });
    }, []);


    // useEffect(()=>{
    //     DataStore.query(User, (user)=>user.sub.eq(sub)).then((users)=>setDbUser(users[0]))
    //     console.log(dbUser)
    //     console.log('checking if this is dbUser:', dbUser)
    //     // Amplify.Logger.LOG_LEVEL = "DEBUG";
    //     // DataStore.observeQuery(User)
    //     // DataStore.delete(User, Predicates.ALL)
    //     // DataStore.clear()
    // }, [sub])
    useEffect(() => {
        if (sub) {
            DataStore.query(User, (user) => user.sub.eq(sub)).then((users) => {
                setDbUser(users[0]);
                console.log('Updated dbUser:', users[0]);
                console.log('this is dbuser',dbUser)
                // Amplify.Logger.LOG_LEVEL = "DEBUG";
                // DataStore.observeQuery(User)
                // DataStore.delete(User, Predicates.ALL)
                // DataStore.clear()
            }).catch((error) => {
                console.log('Error fetching dbUser:', error);
            });
            console.log('see sub and dbuser:', sub,'dbusernkor:', dbUser)
        }
    }, [sub]);


    // This useEffect is for if I want to do things online only ie, I can delete things in the amplify studio and it will delete locally

    // useEffect(() => {
    //     const subscription = DataStore.observeQuery(
    //         User,
    //         user => user.sub.eq(sub)
    //     ).subscribe(snapshot => {
    //         const { items, isSynced } = snapshot;
    //         console.log(`[Snapshot] item count: ${items.length}, isSynced: ${isSynced}`);
    //         if (items[0]) {
    //             setDbUser(items[0])
    //         }
    //     });

    //     return () => {
    //         subscription.unsubscribe()
    //     }
    // }, [sub])
    // console.log("DB USER: ", dbUser)

    return(
        <AuthContext.Provider value={{authUser, dbUser, sub, setDbUser }}>
            {children}
        </AuthContext.Provider>
    )
}

export default AuthContextProvider;

export const useAuthContext = ()=> useContext(AuthContext)

this is for the profile screen where I create and edit the dbuser:

// import '@azure/core-asynciterator-polyfill'
import { View, Text, TextInput, Button, Pressable, Alert } from 'react-native'
import React, {useEffect, useState, } from 'react'
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';
import styles from './styles'
import { useAuthContext } from '../../contexts/AuthContext'
import { useNavigation } from '@react-navigation/native'
import { signOut } from 'aws-amplify/auth';
import { DataStore } from 'aws-amplify/datastore';
import {User} from '../../models'


const ProfileScreen = () => {

  const {sub, dbUser, setDbUser} = useAuthContext()

  const handleSignOut = async()=> {
    try {
      await signOut();
    } catch (error) {
      console.log('error signing out: ', error);
    }
  }
  
    const [name, setName] = useState(dbUser?.name || "")
    const [address, setAddress] = useState(dbUser?.address || "")
    const [phoneNumber, setPhoneNumber]= useState(dbUser?.phoneNumber || "")
    const [lat, setLat] = useState(dbUser?.lat.toString() || "0")
    const [lng, setLng] = useState (dbUser?.lng.toString() || "0") 
    
    const [isFocused, setIsFocused] = useState(false);
   
    const navigation = useNavigation()



    // Start of Function to Create and Update User

    const createUser = async ()=>{
      try{
        const user = await DataStore.save(new User({
         name, 
         address,
         phoneNumber,
         lat:parseFloat(lat), 
         lng:parseFloat(lng), 
         sub
       })
       );
       console.log("I am User:",user)
       setDbUser(user)
     }catch(e){
       Alert.alert("Error", e.message)
     }
    }

    const updateUser= async ()=>{
      const user = await DataStore.save(User.copyOf(dbUser, (updated)=>{
        updated.name = name;
        updated.address = address;
        updated.phoneNumber = phoneNumber
        updated.lat = parseFloat(lat);
        updated.lng = parseFloat(lng);
      }))
      setDbUser(user)
    }
    // End Of Function to Create and Update User

    // Function to Save Data
    const onSave= async()=>{
      if(dbUser){
        await updateUser()
        navigation.goBack()
      }else{
        await createUser()
        navigation.navigate('HomeScreen')
      }
      // navigation.goBack()
    }

    // function to handle focus
    const handleFocusChange = (focused) => {
      setIsFocused(focused);
    };

    // Start Of GooglePlacesAutoComplete
    const handlePlaceSelect = (data, details = null) => {
      // Extract the address from the selected place
      const selectedAddress = data?.description || details?.formatted_address;

      const selectedAddylat = JSON.stringify(details?.geometry?.location.lat) 

      const selectedAddylng = JSON.stringify(details?.geometry?.location.lng) 

      console.log(selectedAddylng, selectedAddylat)
  
      // Update the address state
      setAddress(selectedAddress);
      setLat(selectedAddylat)
      setLng(selectedAddylng)
  
    };
    // End Of GooglePlacesAutoComplete

    return (
    <View style={styles.container}>

      <Text style={styles.title}>Profile</Text>

      <TextInput 
      value={name}
      onChangeText={setName}
      placeholder='Name'
      style={styles.input}
      />

      <TextInput 
      value={address}
      placeholder='Address'
      style={{...styles.input, color: '#04df04'}}
      />

      <View style={isFocused ? styles.gContainerFocused : styles.gContainer}>
        <GooglePlacesAutocomplete
        fetchDetails
        placeholder='Select Address From Here'
        onPress={handlePlaceSelect}
        textInputProps={{
          onFocus:() => handleFocusChange(true),
          onBlur:() => handleFocusChange(false)
        }} 
        styles={{
          textInput:styles.gTextInput,
          textInputContainer:styles.gTextInputContainer,
          listView:styles.glistView,
          poweredContainer:styles.gPoweredContainer
        }}
        query={{
          key: 'AIzaSyADZpw6XnHY',
          language: 'en',
        }}
        />
      </View>

    {/* TextInputs that will be below GooglePlacesAutocomplete */}
    
      <TextInput
      value={phoneNumber}
      onChangeText={setPhoneNumber}
      placeholder='Phone Number'
      style={styles.input}
      />

      <TextInput 
      value={lat}
      placeholder='Latitude'
      style={styles.input}
      />

      <TextInput 
      value={lng}
      placeholder='Longitude'
      style={styles.input}
      />

      <View style={styles.scrnBtn}>
        {/* Save */}
        <Pressable onPress={onSave} style={styles.saveBackground}>
          <Text style={styles.save}>
            Save
          </Text>
        </Pressable>
        
        {/* SignOut */}
        <Pressable onPress={handleSignOut} >
          <Text style={styles.signOut}>
            Sign out
          </Text>
        </Pressable>
      </View>
      
    </View>
  )
}

export default ProfileScreen

Log output

// Put your logs below this line


[WARN] 33:53.414 DataStore - subscriptionError Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field '_version'

{"ACTIVITY_NULL": 4, "PERMISSION_DENIED": 1, "POSITION_UNAVAILABLE": 2, "TIMEOUT": 3, "code": 3, "message": "Location request timed out"}

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": ******,
"aws_appsync_graphqlEndpoint": ******,
"aws_appsync_region": ******,
"aws_appsync_authenticationType": ******,
"aws_appsync_apiKey": ******,
"aws_cognito_identity_pool_id": ******,
"aws_cognito_region": ******,
"aws_user_pools_id": ******,
"aws_user_pools_web_client_id": ******,
"oauth": {},
"aws_cognito_username_attributes": [
"EMAIL"
],
"aws_cognito_social_providers": [],
"aws_cognito_signup_attributes": [],
"aws_cognito_mfa_configuration": "OFF",
"aws_cognito_mfa_types": [
"SMS"
],
"aws_cognito_password_protection_settings": {
"passwordPolicyMinLength": 8,
"passwordPolicyCharacters": [
"REQUIRES_NUMBERS"
]
},
"aws_cognito_verification_mechanisms": [
"EMAIL"
]
};

export default awsmobile;

Manual configuration

No response

Additional configuration

Nothing

Mobile Device

Samsung

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

Nothing

Metadata

Metadata

Assignees

No one assigned

    Labels

    AuthRelated to Auth components/categoryDataStoreRelated to DataStore categoryReact NativeReact Native related issuequestionGeneral question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions