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

Amplify v5 build fails when adding amazon-cognito-identity-js because duplicate symbols #13128

Closed
3 tasks done
Themrpie opened this issue Mar 15, 2024 · 12 comments
Closed
3 tasks done
Assignees
Labels
amazon-cognito-identity-js Used for issues related to this specific package within the monorepo Auth Related to Auth components/category pending-maintainer-response Issue is pending a response from the Amplify team. React Native React Native related issue V5

Comments

@Themrpie
Copy link

Themrpie commented Mar 15, 2024

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication

Amplify Version

v5

Amplify Categories

auth

Backend

Amplify CLI

Environment information

System:
OS: macOS 13.5.1
CPU: (8) arm64 Apple M1
Memory: 102.20 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.8.1 - /opt/homebrew/bin/node
npm: 10.1.0 - /opt/homebrew/bin/npm
Browsers:
Chrome: 119.0.6045.159
Safari: 16.6
npmPackages:
@aws-amplify/react-native: ^1.0.18 => 1.0.20
@aws-amplify/rtn-web-browser: ^1.0.18 => 1.0.20
@babel/core: ^7.20.0 => 7.24.0
@react-native-async-storage/async-storage: ^1.22.3 => 1.22.3
@react-native-community/netinfo: ^11.3.1 => 11.3.1
@react-navigation/native: ^6.1.14 => 6.1.16
@react-navigation/native-stack: ^6.9.22 => 6.9.25
@types/base-64: ^1.0.2 => 1.0.2
@types/react: ~18.2.45 => 18.2.66 (17.0.77)
@types/react-native: ~0.64.12 => 0.64.38
@types/uuid: ^9.0.8 => 9.0.8
HelloWorld: 0.0.1
amazon-cognito-identity-js: ^6.3.12 => 6.3.12
amazon-cognito-identity-js/internals: undefined ()
aws-amplify: ^5.3.17 => 5.3.17
base-64: ^1.0.0 => 1.0.0
expo: ^50.0.13 => 50.0.13
expo-device: ~5.9.3 => 5.9.3
expo-haptics: ~12.8.1 => 12.8.1
expo-linear-gradient: ~12.7.2 => 12.7.2
expo-status-bar: ~1.11.1 => 1.11.1
react: 18.2.0 => 18.2.0
react-native: 0.73.4 => 0.73.4
react-native-get-random-values: ^1.10.0 => 1.11.0
react-native-paper: ^5.12.3 => 5.12.3
react-native-responsive-screen: ^1.4.2 => 1.4.2
react-native-safe-area-context: 4.8.2 => 4.8.2
react-native-screens: ~3.29.0 => 3.29.0
responsive-screen: 0.1.0
responsive-screen-orientation-change: 0.1.0
responsive-screen-styled-components: 0.1.0
typescript: ^5.1.3 => 5.4.2
uuid: ^9.0.1 => 9.0.1 (3.4.0, 8.3.2, 7.0.3)
npmGlobalPackages:
@aws-amplify/cli: 12.3.0
eas-cli: 7.5.0
expo-cli: 6.3.10
npm: 10.1.0

Describe the bug

app build fails when using aws-amplify v5 and amazon-cognito-identity-js

Expected behavior

it should build having the 2 libraries

Reproduction steps

Steps to reproduce:
1 Install amplify in react native expo app following and making sure you are installing the v5:
https://docs.amplify.aws/react-native/start/getting-started/installation/

2 Setup authorization following:
https://docs.amplify.aws/react-native/prev/build-a-backend/auth/set-up-auth/
It will make you install aws-amplify and amazon-cognito-identity-js.

3 Build with: eas build -p ios
You will get the error.

4 execute: npm uninstall amazon-cognito-identity-js
5 execute again: eas build -p ios

And it will build but the authentication won't work. You can create an account but not confirm it.

I've built many apps with Amplify v5 but now when I try to do it I get an error or duplicate symbols.
It's very strange because I also tried by using the same versions that I used in other app with amplify that I'm able to build without issues ("amazon-cognito-identity-js": "^6.3.12" and "aws-amplify": "^5.3.17") and I get the same error.

Hopefully somebody can help me out because I ran out of ideas. I don't want to use v6 yet in part because is not compatible with managed expo and also because I tried by ejecting and building but it didn't work and I've seen others with same and other issues.

Code Snippet

// Put your code below this line.

Log output

Compiling expo-file-system EXFileSystemAssetLibraryHandler.m
› Compiling expo-file-system Pods/ExpoFileSystem » EXFileSystem.m
› Compiling expo-file-system Pods/ExpoFileSystem » EXFilePermissionModule.m
› Packaging expo-file-system Pods/ExpoFileSystem » libExpoFileSystem.a
› Executing expo-file-system Pods/ExpoFileSystem » Copy generated compatibility header
› Compiling Pods/Pods-fonoxia » Pods-fonoxia-dummy.m
› Packaging Pods/Pods-fonoxia » libPods-fonoxia.a
› Executing fonoxia » [CP] Check Pods Manifest.lock
› Executing fonoxia » [Expo] Configure project
› Copying   ios/fonoxia/Supporting/Expo.plist ➜ ./Expo.plist
› Compiling fonoxia » SplashScreen.storyboard
› Preparing fonoxia » Info.plist
› Compiling fonoxia » fonoxia_vers.c
› Compiling fonoxia » main.m
› Compiling fonoxia » AppDelegate.mm
› Linking   fonoxia » fonoxia
⚠️  ld: ignoring duplicate libraries: '-lc++'
❌  duplicate symbol '_OBJC_CLASS_$_JKBigInteger' in
┌─ libAmplifyRTNCore.a[5](JKBigInteger.o)
└─ libRNAWSCognito.a[3](JKBigInteger.o)
❌  duplicate symbol '_OBJC_CLASS_$_JKBigDecimal' in
┌─ libAmplifyRTNCore.a[4](JKBigDecimal.o)
└─ libRNAWSCognito.a[2](JKBigDecimal.o)
❌  duplicate symbol '_OBJC_METACLASS_$_JKBigInteger' in
┌─ libAmplifyRTNCore.a[5](JKBigInteger.o)
└─ libRNAWSCognito.a[3](JKBigInteger.o)
❌  duplicate symbol '_OBJC_IVAR_$_JKBigDecimal.figure' in
┌─ libAmplifyRTNCore.a[4](JKBigDecimal.o)
└─ libRNAWSCognito.a[2](JKBigDecimal.o)
❌  duplicate symbol '_OBJC_METACLASS_$_JKBigDecimal' in
┌─ libAmplifyRTNCore.a[4](JKBigDecimal.o)
└─ libRNAWSCognito.a[2](JKBigDecimal.o)
❌  duplicate symbol '_OBJC_IVAR_$_JKBigDecimal.bigInteger' in
┌─ libAmplifyRTNCore.a[4](JKBigDecimal.o)
└─ libRNAWSCognito.a[2](JKBigDecimal.o)
❌  duplicate symbol '_OBJC_IVAR_$_JKBigInteger.m_value' in
┌─ libAmplifyRTNCore.a[5](JKBigInteger.o)
└─ libRNAWSCognito.a[3](JKBigInteger.o)

❌  ld: 7 duplicate symbols


❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

▸ ** ARCHIVE FAILED **


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

{
"name": "fonoxia",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"@aws-amplify/react-native": "^1.0.18",
"@aws-amplify/rtn-web-browser": "^1.0.18",
"@react-native-async-storage/async-storage": "^1.22.3",
"@react-native-community/netinfo": "^11.3.1",
"@react-navigation/native": "^6.1.14",
"@react-navigation/native-stack": "^6.9.22",
"amazon-cognito-identity-js": "^6.3.12",
"aws-amplify": "^5.3.17",
"base-64": "^1.0.0",
"expo": "^50.0.13",
"expo-device": "~5.9.3",
"expo-haptics": "~12.8.1",
"expo-linear-gradient": "~12.7.2",
"expo-status-bar": "~1.11.1",
"react": "18.2.0",
"react-native": "0.73.4",
"react-native-get-random-values": "^1.10.0",
"react-native-paper": "^5.12.3",
"react-native-responsive-screen": "^1.4.2",
"react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.29.0",
"uuid": "^9.0.1"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@types/base-64": "^1.0.2",
"@types/react": "~18.2.45",
"@types/react-native": "~0.64.12",
"@types/uuid": "^9.0.8",
"typescript": "^5.1.3"
},
"private": true
}

@Themrpie Themrpie added the pending-triage Issue is pending triage label Mar 15, 2024
@cwomack cwomack self-assigned this Mar 15, 2024
@cwomack cwomack added Auth Related to Auth components/category React Native React Native related issue amazon-cognito-identity-js Used for issues related to this specific package within the monorepo V5 labels Mar 15, 2024
@avantmarketing1
Copy link

I have the same issue

@kvramyasri7
Copy link
Contributor

Me Too

@Themrpie
Copy link
Author

Glad to see that I'm not the only one. But I've been stuck here for days and nothing indicates this will be resolved... Very frustrating

@santilaguna
Copy link

santilaguna commented Mar 22, 2024

I have the same problem @kvramyasri7 @Themrpie @avantmarketing1 Did any of you manage to solve the error or did you solve it in an alternative way?

@Themrpie
Copy link
Author

Themrpie commented Mar 22, 2024

No. I even tried by changing the names of the duplicated class names (JKBigInteger and JKBigDecimal) by manually editing the library files. It didn't work, maybe I did it wrong.

I also tried by downgrading into expo 49, but I still get the same problem.

If anybody solved this please share the solution 🙏

@cwomack
Copy link
Member

cwomack commented Mar 26, 2024

Hello @Themrpie, 👋. For anyone experiencing this issue, this looks very similar to the errors reported in #12808. The resolution there was to follow the commands in this comment to remove the dependency and re-install.

Can you please try these steps to see if they resolve the issue?

@cwomack cwomack added pending-response dependencies Pull requests that update a dependency file and removed pending-triage Issue is pending triage dependencies Pull requests that update a dependency file labels Mar 26, 2024
@santilaguna
Copy link

santilaguna commented Mar 26, 2024

Hello @cwomack, thanks for the response

The resolution there needs aws-amplify@6 and then we will not be able to use expo go for example.
So the only alternative is to migrate then?

@Themrpie
Copy link
Author

Themrpie commented Mar 30, 2024

Thanks @cwomack but as I explained if I remove amazon-cognito-identity-js the app compiles but it doesn't function.

I understand that as npm for this library and aws instructions says, you don't need to install it for aws-amplify@6 but for version 5 you need it or it will compile, but not allowing any account login or confirmation (strangely you can create an account but can't confirm it).
And if I install the needed library then I can't compile because of duplicated symbols.

@thecloudslayer
Copy link

thecloudslayer commented Apr 3, 2024

Having the same issue. :( Bumping to v6 is going to be a ton of work for me.

@Themrpie
Copy link
Author

Themrpie commented Apr 3, 2024

It took a huge amount of work but I moved into v6.
Before compiling remember to edit the .gitignore by adding a ! in front of aws-exports.js and amplifyconfiguration.json.

@cwomack
Copy link
Member

cwomack commented Sep 3, 2024

@Themrpie, that's great to hear that you were able to migrate to v6! We'd love to hear any feedback on how the migration guides and documentation could be improved if it felt like a large amount of work. Feel free to provide any improvements you think we could make on the amplify-docs repo here. (CC: @thecloudslayer as well here)

I'll close this issue out though due to the adding amazon-cognito-identity-js package no longer being used in v6.

@cwomack cwomack closed this as completed Sep 3, 2024
@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Sep 3, 2024
@cwomack cwomack removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Sep 9, 2024
@JKKholmatov
Copy link

Same issue, did anyone find solution for Amplify v5?

@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
amazon-cognito-identity-js Used for issues related to this specific package within the monorepo Auth Related to Auth components/category pending-maintainer-response Issue is pending a response from the Amplify team. React Native React Native related issue V5
Projects
None yet
Development

No branches or pull requests

7 participants