Closed VitorFigm closed 1 year ago
@VitorFigm, thank you for opening this issue. We are looking into this and trying to reproduce the dependency errors that you're experiencing. It looks like the page to the documentation that you referenced for the reproduction steps leads to a 404. Was this related to just following the steps within the React Native tutorial?
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!
Sorry for the 1 year delayed answer. I was looking at the code recently and I found that, for some strange unknown reason imports like "@aws-amplify/core" and even other libs that follow the pattern "@aws-amplify/*" weren't using the same version exposed by the root "aws-amplify" package. For some reason, when I try to reproduce this problem now, this problem never happens again (when I posted this issue, even new projects used to use divergent versions).
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Not applicable
Environment information
Describe the bug
I have already found the solution to this bug and am sharing it here to help others who are trying to use Amplify with React Native and Expo.
Problem
When you attempt to follow the official docs on how to set up the Amplify backend, it instructs you to do the following:
However, this leads to the following error when using it with "expo": "^48.0.7":
How to solve this?
To resolve the issue, change this line:
To this:
What is the problem?
Importing "aws-amplify" causes React Native to analyze the dependencies from @aws-sdk, and it will complain about Node.js module imports, even though the front end doesn't need them.
Changes in Amplify
The solution to the problem, in general, is to update the docs to make people import from "@aws-amplify/core".
Expected behavior
React native should not complain about nodeJS modules.
Reproduction steps
Follow those steps
Code Snippet
No response
Log output
aws-exports.js
Additional information and screenshots
My package.json: