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

Is it possible to use 2 different platforms in one amplify app? #3907

Open
3 tasks done
yafimvo opened this issue Jan 28, 2024 · 5 comments
Open
3 tasks done

Is it possible to use 2 different platforms in one amplify app? #3907

yafimvo opened this issue Jan 28, 2024 · 5 comments
Assignees
Labels
feature-request New feature or request monorepo

Comments

@yafimvo
Copy link

yafimvo commented Jan 28, 2024

Before opening, please confirm:

Amplify Hosting feature

Monorepo, SSR

Is your feature request related to a problem? Please describe:

I have a monorepo with two applications: one in React and another in Next.js. Each project has its own amplify.yml in its root folder. While I was able to build both applications in my Amplify, the CI/CD doesn't work properly because the app's platform should be 'Web' for React and 'Web compute' for Next.js. As a result, I need to manually change it every time I want to deploy one of them.

Also, a follow up question - is it possible to set the AMPLIFY_MONOREPO_APP_ROOT from one of the configuration files?

Describe how you'd like this feature to work

Generally, my goal is to connect both monorepo folders (react and nextjs) into 1 URL, i.e. https://example.com which is hosted on Amplify. Then, for every example.com/app2, this should show the Next.js app; otherwise, it should show the React app. I was able to achieve this with a rewrite, however, I wonder if there is a simpler way to do it that will also support CI/CD.

@yafimvo yafimvo added the feature-request New feature or request label Jan 28, 2024
Copy link

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

@kvramyasri7
Copy link

kvramyasri7 commented Feb 3, 2024

Any update? trying to do the same and few folks are reaching out to ME!

@kvramyasri7
Copy link

cc: @Milan-Shah @chrisbonifacio

@kvramyasri7
Copy link

Ummmm, oops have not realized have opened a duplicate copy/paste issue sorry u guys !!!!

@yafimvo
Copy link
Author

yafimvo commented Feb 13, 2024

Ummmm, oops have not realized have opened a duplicate copy/paste issue sorry u guys !!!!

@kvramyasri7

Thanks for bumping it up! I'm still waiting for a better solution since the CI/CD is quite a mess.

Maybe a quick solution would be allowing to update specific env params.

this way I can write a small github action script that runs whenever I want to deploy NextJS to Amplify (I can do it now but I need to share all of my Amplify secrets).

Something like this:

  1. Change the platform
aws amplify update-app --app-id <my-app-id> \
    --platform WEB_COMPUTE 
    --region <my-region>
    --update-environment-variables AMPLIFY_MONOREPO_APP_ROOT=nextjs
  1. push to my main nextjs branch branch, i.e., main_nextjs_branch, to invoke the build on Amplify

  2. After a successful build - return the platform to WEB

aws amplify update-app --app-id <my-app-id> \
    --platform WEB 
    --region <my-region>
    --update-environment-variables AMPLIFY_MONOREPO_APP_ROOT=react

Note I tried to create a conditional variable but it doesn't work for AMPLIFY_MONOREPO_APP_ROOT so fixing this might be also useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request monorepo
Projects
None yet
Development

No branches or pull requests

5 participants