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.41k stars 2.12k forks source link

'PlatformNotSupported: Function not supported on current platform' error during signIn in react native for v6 #12831

Closed jj2020driver closed 6 months ago

jj2020driver commented 8 months ago

Before opening, please confirm:

JavaScript Framework

React, React Native, Next.js

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth, storage

Backend

Other

Environment information

``` # Put output below this line System: OS: macOS 12.7.1 CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz Memory: 73.87 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 9.9.2 - ~/.nvm/versions/node/v16.13.1/bin/npm Browsers: Chrome: 120.0.6099.199 Safari: 15.6.1 npmPackages: @5stones/react-native-switch: ^2.0.0 => 2.0.0 @ampproject/toolbox-optimizer: undefined () @apollo/client: ^3.3.12 => 3.8.4 @apollo/client/cache: undefined () @apollo/client/core: undefined () @apollo/client/dev: undefined () @apollo/client/errors: undefined () @apollo/client/link/batch: undefined () @apollo/client/link/batch-http: undefined () @apollo/client/link/context: undefined () @apollo/client/link/core: undefined () @apollo/client/link/error: undefined () @apollo/client/link/http: undefined () @apollo/client/link/persisted-queries: undefined () @apollo/client/link/remove-typename: undefined () @apollo/client/link/retry: undefined () @apollo/client/link/schema: undefined () @apollo/client/link/subscriptions: undefined () @apollo/client/link/utils: undefined () @apollo/client/link/ws: undefined () @apollo/client/react: undefined () @apollo/client/react/components: undefined () @apollo/client/react/context: undefined () @apollo/client/react/hoc: undefined () @apollo/client/react/hooks: undefined () @apollo/client/react/parser: undefined () @apollo/client/react/ssr: undefined () @apollo/client/testing: undefined () @apollo/client/testing/core: undefined () @apollo/client/utilities: undefined () @apollo/client/utilities/globals: undefined () @aws-amplify/react-native: ^1.0.10 => 1.0.10 @babel/core: ^7.22.20 => undefined (7.23.0, ) @babel/eslint-parser: ^7.22.5 => 7.22.15 @babel/runtime: ^7.23.1 => 7.15.4 (7.23.1) @babel/types: ^7.22.19 => 7.23.0 @bam.tech/react-native-image-resizer: ^3.0.7 => 3.0.7 @contentful/rich-text-react-renderer: ^15.16.3 => 15.17.2 @contentful/rich-text-types: ^16.0.3 => 16.3.0 @edge-runtime/primitives: 1.1.0-beta.31 @emotion/react: ^11.3.0 => 11.11.1 @emotion/styled: ^11.3.0 => 11.11.0 @grovertb/react-native-actionsheet: ^2.4.2 => 2.4.2 @hapi/accept: undefined () @mui/material: ^5.12.1 => 5.14.10 @napi-rs/triples: undefined () @next/bundle-analyzer: ^13.2.4 => 13.5.2 @next/env: ^12.2.6 => 12.3.4 (13.5.2) @next/react-dev-overlay: undefined () @percy/testcafe: ^0.2.1 => 0.2.1 @react-google-maps/api: ^2.1.1 => 2.19.2 @react-native-async-storage/async-storage: ^1.21.0 => 1.21.0 @react-native-community/eslint-config: 3.2.0 => 3.2.0 @react-native-community/geolocation: ^3.1.0 => 3.1.0 @react-native-community/image-editor: ^2.3.0 => 2.3.0 @react-native-community/masked-view: ^0.1.10 => 0.1.11 @react-native-community/netinfo: ^6.0.0 => 6.0.0 @react-native-firebase/analytics: ^15.1.1 => 15.7.0 @react-native-firebase/app: ^15.1.1 => 15.7.0 @react-native-firebase/crashlytics: ^15.1.1 => 15.7.0 @react-native/gradle-plugin: 0.72.11 => 0.72.11 @react-navigation/bottom-tabs: ^5.11.8 => 5.11.15 @react-navigation/native: ^5.8.10 => 5.9.8 (3.8.4) @react-navigation/stack: ^5.12.8 => 5.14.9 @segment/ajv-human-errors: undefined () @skele/components: ^1.0.0-alpha.40 => 1.0.0-alpha.40 @table-library/react-table-library: ^4.1.4 => 4.1.7 @testing-library/testcafe: ^4.3.1 => 4.4.1 @types/google-libphonenumber: ^7.4.28 => 7.4.28 @types/jest: ^25.2.3 => 25.2.3 @types/lodash.uniqueid: ^4.0.7 => 4.0.7 @types/react: ^17.0.53 => 17.0.65 @types/react-gtm-module: ^2.0.1 => 2.0.1 @types/react-loading-overlay: ^1.0.1 => 1.0.1 @types/react-native: ^0.71.1 => 0.71.8 @typescript-eslint/eslint-plugin: ^5.58.0 => 5.62.0 @ungap/global-this: ^0.4.4 => 0.4.4 @vercel/nft: undefined () HelloWorld: 0.0.1 acorn: undefined () amphtml-validator: undefined () arg: undefined () assert: undefined () async-retry: undefined () async-sema: undefined () aws-amplify: ^6.0.10 => 6.0.10 aws-amplify/adapter-core: undefined () aws-amplify/analytics: undefined () aws-amplify/analytics/kinesis: undefined () aws-amplify/analytics/kinesis-firehose: undefined () aws-amplify/analytics/personalize: undefined () aws-amplify/analytics/pinpoint: undefined () aws-amplify/api: undefined () aws-amplify/api/server: undefined () aws-amplify/auth: undefined () aws-amplify/auth/cognito: undefined () aws-amplify/auth/cognito/server: undefined () aws-amplify/auth/enable-oauth-listener: undefined () aws-amplify/auth/server: undefined () aws-amplify/datastore: undefined () aws-amplify/in-app-messaging: undefined () aws-amplify/in-app-messaging/pinpoint: undefined () aws-amplify/push-notifications: undefined () aws-amplify/push-notifications/pinpoint: undefined () aws-amplify/storage: undefined () aws-amplify/storage/s3: undefined () aws-amplify/storage/s3/server: undefined () aws-amplify/storage/server: undefined () aws-amplify/utils: undefined () axios: ^0.21.4 => 0.21.4 (0.27.2) axios-cache-adapter: ^2.7.3 => 2.7.3 babel-jest: 25.5.1 => 25.5.1 babel-loader: ^8.2.2 => 8.3.0 babel-packages: undefined () babel-plugin-transform-runtime: ^6.23.0 => 6.23.0 base-64: ^1.0.0 => 1.0.0 (0.1.0) bodybuilder: ^2.5.1 => 2.5.1 bootstrap: ^4.6.0 => 4.6.2 browserify-zlib: undefined () browserslist: undefined () buffer: undefined () bytes: undefined () caniuse-lite: ^1.0.30001502 => 1.0.30001538 chalk: undefined () ci-info: undefined () classnames: ^2.3.1 => 2.3.2 cli-select: undefined () comment-json: undefined () compression: undefined () compressorjs: ^1.2.1 => 1.2.1 conf: undefined () constants-browserify: undefined () content-disposition: undefined () content-type: undefined () contentful: ^9.1.5 => 9.3.5 contentful-typescript-codegen: ^3.2.3 => 3.4.0 cookie: undefined () core-js: ^3.30.1 => 3.32.2 (2.6.12, 1.2.7) cross-env: ^7.0.3 => 7.0.3 cross-spawn: undefined () cross-var: ^1.1.0 => 1.1.0 crypto-browserify: undefined () cssnano-simple: undefined () cucumber: ^5.1.0 => 5.1.0 date-fns: ^2.30.0 => 2.30.0 debug: undefined () deprecated-react-native-prop-types: ^4.2.1 => 4.2.1 (2.3.0, 3.0.1) devalue: undefined () domain-browser: undefined () edge-runtime: undefined () element-resize-event: ^3.0.6 => 3.0.6 env-cmd: ^10.1.0 => 10.1.0 eslint: ^8.0.0 => 8.49.0 eslint-config-next: ^12.1.0 => 12.3.4 eslint-plugin-autofix: ^1.1.0 => 1.1.0 eslint-plugin-jest: ^25.7.0 => 25.7.0 (26.9.0) eslint-plugin-react: ^7.26.1 => 7.33.2 eslint-plugin-react-native: ^4.0.0 => 4.1.0 events: undefined () find-cache-dir: undefined () find-up: undefined () formik: ^2.2.6 => 2.4.5 fresh: undefined () geolocationexample: 0.0.0 get-orientation: undefined () gherkin-testcafe: ^3.0.1 => 3.0.1 glob: undefined () google-libphonenumber: ^3.2.30 => 3.2.33 graphql: ^15.5.0 => 15.8.0 gzip-size: undefined () hermes-engine: ^0.11.0 => 0.11.0 http-proxy: undefined () https-browserify: undefined () husky: ^7.0.0 => 7.0.4 icss-utils: undefined () ignore-loader: undefined () image-size: undefined () intl-tel-input: ^17.0.18 => 17.0.21 is-animated: undefined () is-docker: undefined () is-wsl: undefined () jest: ^25.5.4 => 25.5.4 jest-worker: undefined () jetifier: ^2.0.0 => 2.0.0 jsc-android: ^250230.2.1 => 250230.2.1 (250231.0.0) json5: undefined () jsonwebtoken: undefined () libphonenumber-js: ^1.10.13 => 1.10.44 libphonenumber-js/build: undefined () libphonenumber-js/core: undefined () libphonenumber-js/max: undefined () libphonenumber-js/max/metadata: undefined () libphonenumber-js/min: undefined () libphonenumber-js/min/metadata: undefined () libphonenumber-js/mobile: undefined () libphonenumber-js/mobile/examples: undefined () libphonenumber-js/mobile/metadata: undefined () loader-utils: undefined () lodash.curry: undefined () lodash.debounce: ^4.0.8 => 4.0.8 lodash.throttle: ^4.1.1 => 4.1.1 lodash.uniqueid: ^4.0.1 => 4.0.1 lottie-ios: ~3.4.0 => 3.4.4 lottie-react-native: ~5.1.5 => 5.1.6 lru-cache: undefined () matcher: ^5.0.0 => 5.0.0 metro-config: ^0.73.10 => 0.73.10 metro-react-native-babel-preset: 0.59.0 => 0.59.0 (0.73.10) micromatch: undefined () mini-css-extract-plugin: undefined () moment: ^2.29.1 => 2.29.4 moment-timezone: ^0.5.33 => 0.5.43 nanoid: undefined () native-url: undefined () neo-async: undefined () next: ^12.3.4 => 12.3.4 next-absolute-url: ^1.2.2 => 1.2.2 next-sitemap: ^4.2.3 => 4.2.3 node-fetch: undefined () node-html-parser: undefined () ora: undefined () os-browserify: undefined () overlayscrollbars: ^2.3.1 => 2.3.1 overlayscrollbars-react: ^0.5.2 => 0.5.2 p-limit: undefined () patch-package: ^8.0.0 => 8.0.0 path-browserify: undefined () pluralize: ^8.0.0 => 8.0.0 postcss-flexbugs-fixes: undefined () postcss-modules-extract-imports: undefined () postcss-modules-local-by-default: undefined () postcss-modules-scope: undefined () postcss-modules-values: undefined () postcss-preset-env: undefined () postcss-safe-parser: undefined () postcss-scss: undefined () postcss-value-parser: undefined () process: undefined () prop-types: ^15.7.2 => 15.8.1 (15.7.2, 15.5.8) punycode: undefined () qs: ^6.7.0 => 6.11.2 (6.11.0, 6.5.3) querystring-es3: undefined () raw-body: undefined () react: ^18.2.0 => 18.2.0 react-avatar: ^5.0.0 => 5.0.3 react-barcode: ^1.4.1 => 1.4.6 react-bootstrap: ^1.5.2 => 1.6.7 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-day-picker: ^8.7.0 => 8.8.2 react-dom: ^18.0.2 => 18.2.0 react-easy-crop: ^3.3.2 => 3.5.3 react-google-autocomplete: ^2.4.0 => 2.7.3 react-google-recaptcha: ^2.1.0 => 2.1.0 react-gtm-module: ^2.0.11 => 2.0.11 react-icons: ^4.2.0 => 4.11.0 react-infinite-scroll-component: ^6.1.0 => 6.1.0 react-is: 17.0.2 react-jotform-embed: ^1.1.3 => 1.1.3 react-loading-overlay: ^1.0.1 => 1.0.1 react-loading-skeleton: ^3.0.1 => 3.3.1 react-modal-video: ^2.0.0 => 2.0.1 react-native: ^0.71.13 => 0.71.13 react-native-animated-loader: 0.0.9 => 0.0.9 react-native-barcode-mask: ^1.2.4 => 1.2.4 react-native-calendar-events: ^2.2.0 => 2.2.0 react-native-calendar-picker: ^7.1.2 => 7.1.4 react-native-camera: ^4.2.1 => 4.2.1 react-native-cardview: ^2.0.5 => 2.0.5 react-native-config: ^1.4.2 => 1.5.1 react-native-dotenv: ^2.5.3 => 2.6.2 react-native-dropdown-picker: ^5.4.6 => 5.4.6 react-native-fast-image: ^8.3.4 => 8.6.3 react-native-fs: ^2.20.0 => 2.20.0 react-native-gesture-handler: ^2.13.1 => 2.13.1 react-native-get-random-values: ^1.10.0 => 1.10.0 react-native-google-maps: ^1.0.0 => 1.0.0 react-native-hole-view: ^2.1.2 => 2.2.1 react-native-image-pan-zoom: ^2.1.12 => 2.1.12 react-native-image-picker: ^7.0.1 => 7.0.2 react-native-intl-phone-input: ^1.2.27 => 1.2.27 react-native-keychain: ^6.2.0 => 6.2.0 react-native-linear-gradient: ^2.5.6 => 2.8.3 react-native-loading-spinner-overlay: ^2.0.0 => 2.0.0 react-native-maps: ^1.4.0 => 1.7.1 react-native-modal: ^13.0.1 => 13.0.1 react-native-onesignal: ^4.5.2 => 4.5.2 react-native-orientation-locker: 1.2.0 => 1.2.0 react-native-pager-view: ^5.1.2 => 5.4.25 react-native-permissions: ^3.0.4 => 3.9.2 react-native-phone-number-input: ^2.1.0 => 2.1.0 react-native-popup-menu: ^0.15.12 => 0.15.13 react-native-raw-bottom-sheet: ^2.2.0 => 2.2.0 react-native-reanimated: ^3.5.4 => 3.5.4 react-native-recaptcha-that-works: ^1.3.2 => 1.3.2 react-native-safe-area-context: ^4.7.2 => 4.7.2 react-native-safe-area-view: ^2.0.0 => 2.0.0 (0.14.9) react-native-screens: ^3.25.0 => 3.25.0 react-native-snap-carousel: ^3.9.1 => 3.9.1 react-native-status-bar-height: ^2.6.0 => 2.6.0 react-native-svg: ^12.1.0 => 12.5.1 react-native-svg-transformer: ^0.14.3 => 0.14.3 react-native-tab-view: ^3.0.0 => 3.5.2 react-native-toast-message: ^1.4.9 => 1.6.0 react-native-typescript-transformer: ^1.2.13 => 1.2.13 react-native-vector-icons: ^10.0.0 => 10.0.0 react-native-video: ^5.1.1 => 5.2.1 react-native-video-controls: ^2.7.1 => 2.8.1 react-native-view-shot: ^3.1.2 => 3.7.0 react-native-webview: ^11.22.7 => 11.26.1 react-navigation: ^4.4.3 => 4.4.4 react-number-format: ^4.6.0 => 4.9.4 react-onclickoutside: ^6.10.0 => 6.13.0 react-paginate: ^8.2.0 => 8.2.0 react-player: ^2.9.0 => 2.13.0 react-pro-sidebar: ^0.6.0 => 0.6.0 react-refresh: 0.12.0 react-server-dom-webpack: undefined () react-share: ^4.4.0 => 4.4.1 react-side-bar: ^1.0.4 => 1.0.4 react-slick: ^0.29.0 => 0.29.0 react-swipeable: ^6.1.0 => 6.2.2 react-switch: ^6.0.0 => 6.1.0 react-test-renderer: ^18.2.0 => 18.2.0 regenerator-runtime: 0.13.4 rn-material-ui-textfield: ^1.0.9 => 1.0.9 sass: ^1.32.8 => 1.67.0 sass-loader: undefined () schema-utils: undefined () semver: undefined () send: undefined () setimmediate: undefined () slick-carousel: ^1.8.1 => 1.8.1 source-map: undefined () stream-browserify: undefined () stream-http: undefined () string-hash: undefined () string_decoder: undefined () strip-ansi: undefined () tar: undefined () terser: undefined () test: 0.0.1 testcafe: ^1.13.0 => 1.20.1 testcafe-browser-provider-browserstack: ^1.13.2-alpha.1 => 1.15.1 text-table: undefined () timers-browserify: undefined () tty-browserify: undefined () typescript: ^4.4.4 => 4.9.5 (3.9.10) ua-parser-js: undefined () unistore: undefined () url-parse: ^1.5.3 => 1.5.10 util: undefined () video-react: ^0.16.0 => 0.16.0 vm-browserify: undefined () watchpack: undefined () web-vitals: undefined () webpack: undefined () webpack-sources: undefined () ws: undefined () yup: ^0.32.9 => 0.32.11 npmGlobalPackages: corepack: 0.10.0 npm: 9.9.2 ```

Describe the bug

Upgrading amplify on existing fully functioning project from v5 to v6, implementing Auth pieces with new syntax. signIn from 'aws-amplify/auth' performs well in browser, but there's problem in Xcode emulator.

signIn call throws the following error: PlatformNotSupported: Function not supported on current platform

I searched @aws-amplify/core library for all places where this error is thrown and found one place that can be directly related: /node_modules/@aws-amplify/core/src/storage/KeyValueStorage.ts

KeyValueStorage class constructor, which has 1 optional parameter, is called a few times during app start, prior to any aws-amplify/auth method calls. Some of these calls seem good, but one not. In particular, in few cases constructor is called with argument { storage: {} } And in one of them it's called with undefined , which looks suspicious.

When signIn method from 'aws-amplify/auth' is called, getItem method from KeyValueStorage instance throws the error.

Result: can't sign in

Expected behavior

Can sign in

Reproduction steps

see description

Code Snippet

in /node_modules/@aws-amplify/core/src/storage/KeyValueStorage.ts


    async getItem(key: string) {
        if (!this.storage) throw new PlatformNotSupportedError();
        return this.storage.getItem(key);
    }

Log output

``` PlatformNotSupported: Function not supported on current platform PlatformNotSupported: Function not supported on current platform at construct (native) at apply (native) at _construct at Wrapper at _construct at _callSuper at AmplifyError at _construct at _callSuper at PlatformNotSupportedError at getItem$ at call at tryCatch ... at anonymous at tryCallTwo (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:61:9) at doResolve (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:216:25) at Promise (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:82:14) at callInvokeWithMethodAndArg at value ... at getItem at getLastAuthUser$ at call ... at getLastAuthUser at getAuthKeys$ ... at anonymous at clearTokens at clearTokens$ at call (native) at tryCatch ... at clearTokens at signOut$ at call (native) ... at anonymous at tryCallOne (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:53:16) at anonymous (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:139:27) at apply (native) at anonymous at _callTimer at _callReactNativeMicrotasksPass at callReactNativeMicrotasks at __callReactNativeMicrotasks at anonymous at __guard at flushedQueue at callFunctionReturnFlushedQueue ```

aws-exports.js

No response

Manual configuration

No response

Additional configuration

part of Podfile look like this:

``` require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' platform :ios, '13.4' prepare_react_native_project! $RNFirebaseAnalyticsWithoutAdIdSupport = true $FirebaseSDKVersion = '9.2.0' $RNFirebaseAsStaticFramework = true linkage = ENV['USE_FRAMEWORKS'] if linkage != nil Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green use_frameworks! :linkage => linkage.to_sym end abstract_target 'App' do config = use_native_modules! # Flags change depending on the env values. flags = get_default_flags() use_react_native!( :path => config[:reactNativePath], :fabric_enabled => flags[:fabric_enabled], :app_path => "#{Pod::Config.instance.installation_root}/.." ) # React Native Maps dependencies rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => rn_maps_path pod 'Firebase', :modular_headers => true pod 'FirebaseCore', :modular_headers => true pod 'GoogleUtilities', :modular_headers => true permissions_path = '../node_modules/react-native-permissions/ios' target 'CustomTarget' do #Production-specific pods pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars" pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse" pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy" pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways" pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications" pod 'Permission-Camera', :path => "#{permissions_path}/Camera" target 'CustomTarget' do inherit! :complete end end ```

Mobile Device

No response

Mobile Operating System

XCode Version 14.2 (14C18) launched on iPhone 14 emulator,

Android Studio Giraffe | 2022.3.1 Patch 2 Build #AI-223.8836.35.2231.10811636, built on September 15, 2023 Runtime version: 17.0.6+0-17.0.6b829.9-10027231 x86_6

launched on Galaxy Nexus API 30 emulator

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

cwomack commented 7 months ago

Hello, @jj2020driver 👋. I haven't experienced this issue when building a new app on React Native with v6 of Amplify, but this might be related to the upgrading from v5 and the node_modules being out of date. Can you see if deleting the node_modules folder, deleting your package-lock.json file, and then reinstalling dependencies with npm i helps resolve the issue when you run the app in the Xcode emulator again?

cwomack commented 7 months ago

Closing this issue as we have not heard back from you. If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue.

Thank you!

jj2020driver commented 7 months ago

@cwomack Hi. Sorry for not getting back earlier. We've got this same error on two different machines. Before running, we clean node_modules, Pods, lock files, npm cache, Build folder in Xcode and Android Studio and install from scratch.

We've paused updating to v6 on our project and thinking of moving interactions with Cognito to back-end side.

Dependencies list and system information in ticket description is relevant. PlatformNotSupported: Function not supported on current platform Error is reproduced every time we launch mobile app in Xcode and Android Studio and try to call a simple Sign In.

Thank you!

cwomack commented 7 months ago

@jj2020driver, thanks for the follow up. Are you able to provide either a minimal sample app that can reproduce this or possibly share more of the frontend code where this is happening?

cwomack commented 6 months ago

@jj2020driver, just wanted to see if you're still experiencing this. Hoping we can help unblock you in your migration to v6!

cwomack commented 6 months ago

Closing this issue as we have not heard back from you. If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue.

Thank you!