aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.42k stars 2.11k forks source link

upgrading aws-amplify stops all aws services on phone #8867

Closed my-name-is-nheo closed 3 years ago

my-name-is-nheo commented 3 years ago

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Not applicable

Amplify Categories

Not applicable

Environment information

``` # Put output below this line System: OS: macOS 11.2.3 CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz Memory: 338.01 MB / 32.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 14.15.2 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 6.14.9 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Browsers: Chrome: 93.0.4577.63 Safari: 14.0.3 npmPackages: @aws-amplify/analytics: ^4.0.9 => 4.0.22 @aws-amplify/pushnotification: ^3.2.21 => 3.2.32 @aws-amplify/ui-react: ^0.2.33 => 0.2.38 @babel/core: ^7.12.10 => 7.15.5 @babel/plugin-proposal-class-properties: ^7.12.1 => 7.14.5 @babel/preset-env: ^7.12.11 => 7.15.4 @babel/runtime: ^7.12.5 => 7.15.4 @reach/router: ^1.3.4 => 1.3.4 @react-native-async-storage/async-storage: ^1.13.2 => 1.15.7 @react-native-community/datetimepicker: ^3.0.9 => 3.5.2 @react-native-community/eslint-config: ^2.0.0 => 2.0.0 @react-native-community/masked-view: ^0.1.10 => 0.1.11 @react-native-community/netinfo: ^5.9.10 => 5.9.10 @react-native-community/picker: ^1.8.1 => 1.8.1 @react-native-community/push-notification-ios: ^1.8.0 => 1.10.0 (1.0.3) @react-native-community/slider: ^3.0.3 => 3.0.3 @react-navigation/drawer: ^5.11.4 => 5.12.9 @react-navigation/stack: ^5.12.8 => 5.14.9 @testing-library/react-native: ^7.1.0 => 7.2.0 @types/node: ^14.14.14 => 14.17.15 (12.20.24) @types/react: ^17.0.0 => 17.0.20 @types/react-native: ^0.57.65 => 0.57.65 (0.64.14) @types/react-native-vector-icons: ^6.4.6 => 6.4.8 HelloWorld: 0.0.1 amazon-cognito-identity-js: ^4.5.6 => 4.6.3 (4.5.10) aws-amplify: ^3.3.18 => 3.4.3 aws-amplify-react-native: ^4.2.10 => 4.3.3 aws-sdk: ^2.812.0 => 2.984.0 babel-jest: ^26.6.3 => 26.6.3 bootstrap: ^4.5.3 => 4.6.0 concurrently: ^5.3.0 => 5.3.0 deprecated-react-native-listview: 0.0.6 => 0.0.6 enzyme: ^3.11.0 => 3.11.0 enzyme-adapter-react-16: ^1.15.6 => 1.15.6 eslint: ^7.15.0 => 7.32.0 fast-deep-equal: ^3.1.3 => 3.1.3 final-form: ^4.20.2 => 4.20.2 hermes-inspector-msggen: 1.0.0 husky: ^4.3.6 => 4.3.8 jest: ^26.6.3 => 26.6.3 jetifier: ^1.6.6 => 1.6.8 lodash: ^4.17.20 => 4.17.21 lottie-react-native: ^3.5.0 => 3.5.0 metro-react-native-babel-preset: ^0.64.0 => 0.64.0 (0.59.0) moment: ^2.29.1 => 2.29.1 moment-timezone: ^0.5.32 => 0.5.33 mqtt-shadows-cognitopool: 0.1.0 native-base: ^2.15.2 => 2.15.2 prettier: ^2.2.1 => 2.3.2 react: 16.13.1 => 16.13.1 (16.8.3) react-animated: 0.1.0 react-bootstrap: ^1.4.0 => 1.6.1 react-bootstrap/AbstractNav: undefined () react-bootstrap/AbstractNavItem: undefined () react-bootstrap/Accordion: undefined () react-bootstrap/AccordionCollapse: undefined () react-bootstrap/AccordionContext: undefined () react-bootstrap/AccordionToggle: undefined () react-bootstrap/Alert: undefined () react-bootstrap/Badge: undefined () react-bootstrap/BootstrapModalManager: undefined () react-bootstrap/Breadcrumb: undefined () react-bootstrap/BreadcrumbItem: undefined () react-bootstrap/Button: undefined () react-bootstrap/ButtonGroup: undefined () react-bootstrap/ButtonToolbar: undefined () react-bootstrap/Card: undefined () react-bootstrap/CardColumns: undefined () react-bootstrap/CardContext: undefined () react-bootstrap/CardDeck: undefined () react-bootstrap/CardGroup: undefined () react-bootstrap/CardImg: undefined () react-bootstrap/Carousel: undefined () react-bootstrap/CarouselCaption: undefined () react-bootstrap/CarouselItem: undefined () react-bootstrap/CloseButton: undefined () react-bootstrap/Col: undefined () react-bootstrap/Collapse: undefined () react-bootstrap/Container: undefined () react-bootstrap/Dropdown: undefined () react-bootstrap/DropdownButton: undefined () react-bootstrap/DropdownItem: undefined () react-bootstrap/DropdownMenu: undefined () react-bootstrap/DropdownToggle: undefined () react-bootstrap/ElementChildren: undefined () react-bootstrap/Fade: undefined () react-bootstrap/Feedback: undefined () react-bootstrap/Figure: undefined () react-bootstrap/FigureCaption: undefined () react-bootstrap/FigureImage: undefined () react-bootstrap/Form: undefined () react-bootstrap/FormCheck: undefined () react-bootstrap/FormCheckInput: undefined () react-bootstrap/FormCheckLabel: undefined () react-bootstrap/FormContext: undefined () react-bootstrap/FormControl: undefined () react-bootstrap/FormFile: undefined () react-bootstrap/FormFileInput: undefined () react-bootstrap/FormFileLabel: undefined () react-bootstrap/FormGroup: undefined () react-bootstrap/FormLabel: undefined () react-bootstrap/FormText: undefined () react-bootstrap/Image: undefined () react-bootstrap/InputGroup: undefined () react-bootstrap/Jumbotron: undefined () react-bootstrap/ListGroup: undefined () react-bootstrap/ListGroupItem: undefined () react-bootstrap/Media: undefined () react-bootstrap/Modal: undefined () react-bootstrap/ModalBody: undefined () react-bootstrap/ModalContext: undefined () react-bootstrap/ModalDialog: undefined () react-bootstrap/ModalFooter: undefined () react-bootstrap/ModalHeader: undefined () react-bootstrap/ModalTitle: undefined () react-bootstrap/Nav: undefined () react-bootstrap/NavContext: undefined () react-bootstrap/NavDropdown: undefined () react-bootstrap/NavItem: undefined () react-bootstrap/NavLink: undefined () react-bootstrap/Navbar: undefined () react-bootstrap/NavbarBrand: undefined () react-bootstrap/NavbarCollapse: undefined () react-bootstrap/NavbarContext: undefined () react-bootstrap/NavbarToggle: undefined () react-bootstrap/Overlay: undefined () react-bootstrap/OverlayTrigger: undefined () react-bootstrap/PageItem: undefined () react-bootstrap/Pagination: undefined () react-bootstrap/Popover: undefined () react-bootstrap/PopoverContent: undefined () react-bootstrap/PopoverTitle: undefined () react-bootstrap/ProgressBar: undefined () react-bootstrap/ResponsiveEmbed: undefined () react-bootstrap/Row: undefined () react-bootstrap/SafeAnchor: undefined () react-bootstrap/SelectableContext: undefined () react-bootstrap/Spinner: undefined () react-bootstrap/SplitButton: undefined () react-bootstrap/Switch: undefined () react-bootstrap/Tab: undefined () react-bootstrap/TabContainer: undefined () react-bootstrap/TabContent: undefined () react-bootstrap/TabContext: undefined () react-bootstrap/TabPane: undefined () react-bootstrap/Table: undefined () react-bootstrap/Tabs: undefined () react-bootstrap/ThemeProvider: undefined () react-bootstrap/Toast: undefined () react-bootstrap/ToastBody: undefined () react-bootstrap/ToastContext: undefined () react-bootstrap/ToastHeader: undefined () react-bootstrap/ToggleButton: undefined () react-bootstrap/ToggleButtonGroup: undefined () react-bootstrap/Tooltip: undefined () react-bootstrap/createChainedFunction: undefined () react-bootstrap/createWithBsPrefix: undefined () react-bootstrap/divWithClassName: undefined () react-bootstrap/helpers: undefined () react-bootstrap/transitionEndListener: undefined () react-bootstrap/triggerBrowserReflow: undefined () react-bootstrap/types: undefined () react-bootstrap/usePopperMarginModifiers: undefined () react-bootstrap/useWrappedRefWithWarning: undefined () react-devtools: ^4.10.1 => 4.18.0 react-dom: 16.13.1 => 16.13.1 react-final-form: ^6.5.3 => 6.5.3 react-native: 0.63.4 => 0.63.4 react-native-animatable: ^1.3.3 => 1.3.3 react-native-aws-iot-device-shadows: git+https://github.com/my-name-is-nheo/react-native-aws-iot-device-shadows.git => 1.0.1 react-native-calendars: ^1.1249.0 => 1.1266.0 react-native-camera: ^3.40.0 => 3.44.3 react-native-chart-kit: ^6.8.1 => 6.11.0 react-native-charts-wrapper: ^0.5.7 => 0.5.7 react-native-clear-cache: git+https://github.com/sowlutions/react-native-clear-cache.git => 1.0.0 react-native-collapsible: git+https://github.com/my-name-is-nheo/react-native-collapsible.git => 0.11.3 react-native-device-info: ^8.0.5 => 8.3.1 react-native-elements: ^3.4.2 => 3.4.2 react-native-gesture-handler: ^1.9.0 => 1.10.3 react-native-global-props: ^1.1.5 => 1.1.5 react-native-image-resizer: ^1.4.1 => 1.4.5 react-native-infinite-content-loader: git+https://github.com/my-name-is-nheo/react-native-infinite-content-loader.git => 0.1.0 react-native-keyboard-aware-scrollview: ^2.1.0 => 2.1.0 react-native-location: ^2.5.0 => 2.5.0 react-native-modal: ^11.5.6 => 11.10.0 react-native-modal-datetime-picker: ^9.1.0 => 9.2.3 react-native-multiple-select: git+https://github.com/my-name-is-nheo/react-native-multiple-select.git => 0.5.6 react-native-nested-scroll-view: ^9.0.0 => 9.0.0 react-native-paho-mqtt: ^0.1.1 => 0.1.1 react-native-paper: ^4.7.2 => 4.9.2 react-native-popup-menu: ^0.15.10 => 0.15.11 react-native-progress: ^4.1.2 => 4.1.2 react-native-reanimated: ^1.13.2 => 1.13.3 react-native-safe-area-context: ^3.1.9 => 3.3.2 react-native-screens: ^2.16.1 => 2.18.1 react-native-smart-splash-screen: ^2.3.5 => 2.3.5 react-native-svg: ^12.1.1 => 12.1.1 react-native-swiper: ^1.6.0 => 1.6.0 react-native-text-ticker: ^1.11.0 => 1.14.0 react-native-tracking-transparency: ^0.1.0 => 0.1.1 react-native-typography: ^1.4.1 => 1.4.1 react-native-vector-icons: ^7.1.0 => 7.1.0 react-navigation: ^4.4.3 => 4.4.4 react-navigation-drawer: ^2.6.0 => 2.7.1 react-navigation-redux-helpers: ^4.0.1 => 4.0.1 react-navigation-stack: ^2.10.2 => 2.10.4 react-redux: ^7.2.2 => 7.2.5 react-test-renderer: ^16.13.1 => 16.14.0 redux: ^4.0.5 => 4.1.1 redux-devtools-extension: ^2.13.8 => 2.13.9 redux-form: ^8.3.7 => 8.3.7 redux-persist: ^6.0.0 => 6.0.0 redux-persist/integration/react: undefined () redux-thunk: ^2.3.0 => 2.3.0 rn-fetch-blob: ^0.12.0 => 0.12.0 ts-jest: ^26.4.4 => 26.5.6 tslint: ^6.1.3 => 6.1.3 tslint-config-prettier: ^1.18.0 => 1.18.0 typescript: ^4.1.3 => 4.4.2 npmGlobalPackages: @aws-amplify/cli: 4.41.0 awsmobile-cli: 1.1.7 code-push-cli: 3.0.0 concurrently: 5.3.0 detox-cli: 18.0.0 ios-deploy: 1.11.4 jest: 26.6.3 react-devtools: 4.10.4 react-native-cli: 2.0.1 rimraf: 3.0.2 typescript: 4.1.2 ```

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

  1. npm install aws-amplify@latest
  2. remove node_modules
  3. remove cache for metro bundler
  4. npm install
  5. deleted podlock file and podfile folder and install pod install to install dependencies
  6. recompiled and ran through xcode simulator

Code Snippet

No response

Log output

``` // Put your logs below this line ```

aws-exports.js

No response

Manual configuration

Screen Shot 2021-09-08 at 1 45 31 PM

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

chrisbonifacio commented 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.

my-name-is-nheo commented 3 years ago

@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.

chrisbonifacio commented 3 years ago

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
my-name-is-nheo commented 3 years ago

@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.

chrisbonifacio commented 3 years ago

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.

my-name-is-nheo commented 3 years ago

@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.

github-actions[bot] commented 2 years ago

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.