Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When running a separate Frontend from your Backend the backend-cli has unmet peer dependencies #1608

Open
JDMathew opened this issue Jun 4, 2024 · 4 comments
Labels
dependency Issue related to upstream dependency documentation Improvements or additions to documentation

Comments

@JDMathew
Copy link

JDMathew commented Jun 4, 2024

Environment information

- unable to run `npx ampx info` as peer dependencies are missing

Description

When running a separate frontend from B.E on react-native the docs require one to install @aws-amplify/backend-cli this results in unmet peer dependencies and npx ampx commands fail to run as there are a number of missing dependencies

image

@JDMathew JDMathew added the pending-triage Incoming issues that need categorization label Jun 4, 2024
@edwardfoyle
Copy link
Member

edwardfoyle commented Jun 4, 2024

Hi @JDMathew, this happens due to how different package managers deal with unmet peer dependencies. npm and pnpm will automatically resolve and install them. yarn has taken the stance that it will not install unmet peer dependencies and they must be explicitly added to your package.json file. See yarnpkg/berry#3710. If you are using yarn, you can add the missing peer dependencies to your package.json file.

A bit more context about why these packages are peer dependencies:
You'll notice all of the dependencies are either CDK or AWS SDK packages. These packages contain types / classes that are re-exported in various places in our Amplify interfaces. In order to ensure that both our code and the calling code is using the same version of these packages, they must be peer dependencies rather than normal dependencies.

@ykethan ykethan added pending-response Issue is pending response from author dependency Issue related to upstream dependency labels Jun 4, 2024
@JDMathew
Copy link
Author

JDMathew commented Jun 4, 2024

@edwardfoyle, I appreciate the detailed response, the context is useful. I will install these dependencies.

Since most React Native developers use yarn as their package manager (previously recommended by facebook), it would be useful if instructions were added to the docs for adding these devDependencies for yarn consumers. Here is a link to the doc I was following for 'Separate frontend and backend teams'.

On a related note, the docs currently require adding @aws-amplify/backend-cli as dependency with aws-amplify and @aws-amplify/ui-react. @aws-amplify/backend-cli should probably be added as a dev dependency and not a regular dependency. That way it isn't bundled up in the final app build.

@github-actions github-actions bot removed the pending-response Issue is pending response from author label Jun 4, 2024
@edwardfoyle edwardfoyle added the documentation Improvements or additions to documentation label Jun 4, 2024
@edwardfoyle
Copy link
Member

edwardfoyle commented Jun 4, 2024

Yes, we should call this out in the docs. And thanks for bringing up the devDependency issue; that also needs to be corrected. Marking as a docs issue

@edwardfoyle edwardfoyle added bug Something isn't working and removed pending-triage Incoming issues that need categorization bug Something isn't working labels Jun 4, 2024
@josefaidt
Copy link
Contributor

josefaidt commented Jun 6, 2024

Hey @JDMathew to understand your project setup better, is this a monorepo? Are you looking to use the backend CLI in your react-native app's package?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency Issue related to upstream dependency documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants