Skip to content

Amplify Gen 2 with NX - Incorrect framework identification for backend repo

0

I'm using NX for my monorepo and am following the instructions https://docs.amplify.aws/nextjs/deploy-and-host/fullstack-branching/monorepos/

I found that if I follow the following steps to setup the monorepo, the Amplify Console will incorrectly detect the framework of the backend project and actually not identify the backend project is an Amplify project.

  1. Create the monorepo (npx nx create-nx-workspace --preset=next)
  2. cd to the monorepo folder and npm create amplify@latest in /packages/backend
  3. Go to Amplify console and select packages/backend as the monorepo folder for the backend app. In this case, you'll see that the console will not understand this to be amplify Gen 2 but, will detect next.js as the framework

The console correctly identifies the framework as Amplify Gen 2 if I follow the following steps:

  1. Create the nx workspace in a subfolder of the repo (say, "myworkspace")
  2. Create the Amplify inside the subfolder.
  3. Set myworkspace/packages/backend as monorepo root for backend app. In this case, everything works fine.

What is causing this to happen? How can we get the framework to be identified correctly?

More info on the Amplify Discord https://discord.com/channels/705853757799399426/1252749566810259457/1252749566810259457

asked 2 years ago634 views

1 Answer
0

Hey,

Hope you're keeping well.

Amplify Console framework detection relies on scanning the selected monorepo root for build artifacts and config files like amplify.yml or amplify/ directories. In your first setup, because packages/backend is directly under the repo root, the detection logic is finding the Next.js app in packages/frontend first and inferring the framework from that. When you nest the workspace deeper, the scan starts from the specified folder and correctly identifies the Amplify backend.

To fix this without restructuring, explicitly set the build settings in the Amplify Console by editing the app’s build configuration and pointing it to the packages/backend path along with a custom `amplify.

Thanks and regards,
Taz

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.