Closed my-name-is-nheo closed 3 years ago
Hi @my-name-is-nheo 👋 Thanks for raising this issue. Did you upgrade from v3 packages to v4? If so, I would recommend following the steps mentioned on this page to check for duplicate packages. Also, from looking at your dependencies I would not recommend using both scoped packages (such as @aws-amplify/analytics as well as the global package aws-amplify
.
I would stick with the global package and make sure that you are importing Amplify and other packages using named imports like so:
import { Amplify, Analytics, API, ...etc} from `aws-amplify`;
Let me know if any of this information helps.
@chrisbonifacio thanks for the response. Yes I've tried updated everything to v4, but then nothing works after I tried reconfiguring amplify.
i'm currently not using both scoped packages; they are all unused dependencies I will have to clean up later. Only categories in use of @aws-amplify are AWSIoTProvider and push notifications.
Did you visit the troubleshooting page I linked for upgrading amplify packages? If not, please do and paste the output of the commands it instructs you to run here if there are any duplicates.
# Using YARN
yarn list --pattern amplify | \
grep -o -e '@\?aws-amplify[^ ]*' | \
sort | uniq | \
sed -E 's/^(@?[^@]+).*$/\1/g' | \
uniq -d | sort
# Using NPM
npm ls -all 2>/dev/null | \
grep -o -e '@\?aws-amplify[^ ]*' | \
sort | uniq | \
sed -E 's/^(@?[^@]+).*$/\1/g' | \
uniq -d | sort
@chrisbonifacio @aws-amplify/auth @aws-amplify/cache @aws-amplify/core @aws-amplify/interactions @aws-amplify/storage @aws-amplify/xr
this is the output. seems like there are quite a few. Before I run npx npm-check-updates -i '/@?aws-amplify/' && npm update
, do you mind explaining what this duplicity has to do with the issue? I'm just confused.
From the troubleshooting page
Having multiple versions of packages can yield unexpected behavior as modules imported in your code might point to versions not configured by Amplify when calling Amplify.configure.
I believe having different versions of the core package especially could result in multiple instances of Amplify and it's hard to tell which you're using at that point and which is configured properly. The Amplify class was designed to be a Singleton so there should only be one instance.
@chrisbonifacio thank you very much for the response. I will run the command and let you know soon. EDIT: working great. thank you very much for the help. Now I can upgrade packages with some confidence.
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels or Discussions for those types of questions.
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Not applicable
Amplify Categories
Not applicable
Environment information
Describe the bug
Need the latest features of PubSub, upgrading aws-amplify to the latest seems to stop all my AWS services implemented in my app to stop working. Tried reconfiguring my amplify by adding my IAM credentials. Since all the services already exists, did not 'amplify init'
Expected behavior
Update with no disturbance.
Reproduction steps
npm install aws-amplify@latest
pod install
to install dependenciesCode Snippet
No response
Log output
aws-exports.js
No response
Manual configuration
Additional configuration
No response
Mobile Device
iphoneSE (2nd generation) Simulator
Mobile Operating System
iOS
Mobile Browser
Chrome
Mobile Browser Version
No response
Additional information and screenshots
No response