Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Apr 29, 2024

Upgrading Amplify packages

When upgrading Amplify packages, it is important to make sure that there are no duplicate versions of Amplify packages in the node_modules folder tree as a result of the upgrade. 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.

A likely scenario that could point to duplicate versions of packages is getting console messages like:

  • Amplify has not been configured correctly
  • Please make sure the Auth module is configured with a valid Cognito User Pool ID
  • User pool is not configured

To prevent this situation, you can Check for duplicate versions, and if duplicate versions exists, then Upgrade Amplify packages.

Check for duplicate versions

The following commands will show you Amplify packages that appear multiple times in your node_modules folder. If the output is empty, it means that you don't have duplicate versions of Amplify packages.

# 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
# Using YARN
yarn list --pattern amplify |
Select-String -Pattern '(@?aws\-amplify[^@]*).*(?<!deduped)$' |
%{$_.Matches.Groups[1].value} | Group-Object |
Where-Object { $_.Count -gt 1 } | Select-Object -ExpandProperty Name |
Sort-Object
# Using npm
npm ls -all 2>$null |
Select-String -Pattern '(@?aws\-amplify[^@]*).*(?<!deduped)$' |
%{$_.Matches.Groups[1].value} | Group-Object |
Where-Object { $_.Count -gt 1 } | Select-Object -ExpandProperty Name |
Sort-Object