Search code examples
reactjsreact-nativebackendaws-amplifyreact-fullstack

What causes aws amplify libraries to depricate after installation of backend?


I recently started following a tutorial to have user authentication handled by aws on the backend. After configuring everything, the imported libraries become depricated in the node_module folder and everything seems inaccessible. Any information regarding how to fix this is greatly appreciated. When I remove the AWS imports my program runs normally:

P.S. I also tried using "@aws-amplify/core" in place of "aws-amplify" and it did not solve the problem.

import { StatusBar } from 'expo-status-bar';
import { SafeAreaProvider } from 'react-native-safe-area-context';
//import Amplify from 'aws-amplify'; --not working
//import {withAuthenticator} from 'aws-amplify-react-native'; --not working
import config from './src/aws-exports'; //working


import useCachedResources from './components/hooks/useCachedResources';
import useColorScheme from './components/hooks/useColorScheme';
import Navigation from './components/navigation';


//Amplify.configure(config);

function App() {
  const isLoadingComplete = useCachedResources();
  const colorScheme = useColorScheme();

  if (!isLoadingComplete) {
    return null;
  } else {
    return (
      <SafeAreaProvider>
        <Navigation colorScheme={colorScheme} />
        <StatusBar />
      </SafeAreaProvider>
    );
  }
}

//export default App;
export default withAuthenticator(App);


Solution

  • Fixed the problem by re-installing Amplify CLI and libraries. Followed the documentation here:

    1. https://docs.amplify.aws/cli/start/install/

    2. https://docs.amplify.aws/start/getting-started/setup/q/integration/react/#set-up-frontend

    3. https://docs.amplify.aws/start/getting-started/auth/q/integration/react/#authentication-with-amplify