Closed jj2020driver closed 6 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?
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!
@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!
@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?
@jj2020driver, just wanted to see if you're still experiencing this. Hoping we can help unblock you in your migration to v6!
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!
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
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 withundefined
, 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
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
part of Podfile look like this:
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