Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export 'default' (imported as 'Amplify') was not found in 'aws-amplify' #10827

Closed
3 tasks done
guychevelle opened this issue Dec 28, 2022 · 8 comments
Closed
3 tasks done
Assignees
Labels
Core Related to core Amplify issues

Comments

@guychevelle
Copy link

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

DataStore

Amplify Categories

No response

Environment information

# Put output below this line
  System:
    OS: macOS 11.7
    CPU: (4) x64 Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz
    Memory: 159.15 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    npm: 8.6.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 108.0.5359.124
    Safari: 16.0
  npmPackages:
    @aws-amplify/ui-react: ^4.3.1 => 4.3.1 
    @aws-amplify/ui-react-internal:  undefined ()
    @testing-library/jest-dom: ^5.16.5 => 5.16.5 
    @testing-library/react: ^13.4.0 => 13.4.0 
    @testing-library/user-event: ^13.5.0 => 13.5.0 
    aws-amplify: ^5.0.8 => 5.0.8 
    react: ^18.2.0 => 18.2.0 (18.1.0)
    react-dom: ^18.2.0 => 18.2.0 
    react-icons: ^4.7.1 => 4.7.1 
    react-router-dom: ^6.6.1 => 6.6.1 
    react-scripts: 5.0.1 => 5.0.1 
    web-vitals: ^2.1.4 => 2.1.4 
  npmGlobalPackages:
    @aws-amplify/cli: 9.2.1
    corepack: 0.10.0
    npm: 8.6.0


</details>


### Describe the bug

Attempting to configure for multi auth (cognito and IAM) in index.js.  This same code works with no issue for an application using aws-amplify 4.3.36.

### Expected behavior

No errors when running npm start

### Reproduction steps

index.js copied from an existing application that runs with no errors.

### Code Snippet

```javascript
// Put your code below this line.
import { DataStore, AuthModeStrategyType } from 'aws-amplify';
import Amplify from 'aws-amplify';
import config from './aws-exports';

//  additional DataStore configuration to avoid subscription errors
//  when using multiple auth modes (cognito + IAM). aws-amplify bug
//  reference:  https://github.com/aws-amplify/amplify-js/issues/9369
Amplify.configure({
   ...config,
   DataStore: {
     authModeStrategyType: AuthModeStrategyType.MULTI_AUTH
   }
  });



### Log output

<details>

// Put your logs below this line
Compiled with problems:

ERROR in ./src/index.js 22:0-17

export 'default' (imported as 'Amplify') was not found in 'aws-amplify' (possible exports: API, APIClass, AWSCloudWatchProvider, AWSKinesisFirehoseProvider, AWSKinesisProvider, AWSPinpointProvider, AmazonPersonalizeProvider, Amplify, Analytics, Auth, AuthModeStrategyType, Cache, ClientDevice, DataStore, Geo, Hub, I18n, Interactions, Logger, Notifications, Predicates, Predictions, PubSub, ServiceWorker, Signer, SortDirection, Storage, StorageClass, XR, graphqlOperation, syncExpression, withSSRContext)


</details>


### aws-exports.js

_No response_

### 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

My assumption is that something has changed between aws-amplify versions 4.3.36 and 5.0.8.  Is there now a different method/configuration for apps that intend to use multiple auth methods?
@guychevelle guychevelle added the pending-triage Issue is pending triage label Dec 28, 2022
@guychevelle
Copy link
Author

Get the same error when simply using the below:

Amplify.configure(config)

@nadetastic
Copy link
Contributor

Hi @guychevelle

Amplify as a default export is deprecated and you would need to import it as a named export

import { Amplify } from 'aws-amplify'

Could you try this?

@nadetastic nadetastic self-assigned this Dec 28, 2022
@nadetastic nadetastic added the Core Related to core Amplify issues label Dec 28, 2022
@guychevelle
Copy link
Author

awesome! that works.

@cbou
Copy link

cbou commented Dec 30, 2022

MysticalSkeptic added a commit to mad-serverless-react-s23/serverless-lab-5 that referenced this issue Mar 19, 2023
@akbarm
Copy link

akbarm commented Mar 20, 2023

I'm still getting this error applying :

import { Amplify } from 'aws-amplify'

ERROR in ./src/index.js 12:0-14
export 'default' (imported as 'Amplify') was not found in 'aws-amplify'

Full code

import logo from './logo.svg';
import './App.css';

import { Amplify } from 'aws-amplify'
import { withAuthenticator, signOut } from '@aws-amplify/ui-react'

function App({ signOut }) {
return (



logo


Edit src/App.js and save to reload.



Learn React




);
}

export default withAuthenticator(App);

@akbarm
Copy link

akbarm commented Mar 20, 2023

import Amplify from 'aws-amplify';
import awsconfig from './aws-exports';
import { AmplifySignOut, withAuthenticator } from '@aws-amplify/ui-react';

Amplify.configure(awsconfig);

import logo from './logo.svg';
import './App.css';

import { Amplify } from 'aws-amplify'
import { withAuthenticator, signOut } from '@aws-amplify/ui-react'

function App({ signOut }) {
return (






);
}

export default withAuthenticator(App);

@nadetastic nadetastic removed the pending-triage Issue is pending triage label Mar 20, 2023
@nadetastic
Copy link
Contributor

Hi @akbarm, could you open a new issue for this and also share your package.json?

Open new issue - https://github.com/aws-amplify/amplify-js/issues/new/choose

@yashwanth78-bobby
Copy link

export 'API' (imported as 'API') was not found in 'aws-amplify' (possible exports: Amplify)

what about this issue??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Related to core Amplify issues
Projects
None yet
Development

No branches or pull requests

5 participants