aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
451 stars 113 forks source link

Switch from automatic to manual deployments fails #3677

Open hanna-becker opened 1 year ago

hanna-becker commented 1 year ago

Before opening, please confirm:

App Id

d3mqvgiptwomr

AWS Region

eu-central-1

Amplify Hosting feature

Deployments, Manual deploys

Frontend framework

Angular

Next.js version

N/A

Next.js router

N/A

Describe the bug

We connected our git repo through the amplify console and set it up for automatic deployments on each commit about 1.5 years ago. Because the amplify CI/CD does not cover all of our needs, we'd now like to change to manual deployments via amplify publish and do the deployment in the pipeline of our git provider, instead.

We disconnected all the branches in the amplify console (for lack of disconnecting the entire repo) and then added hosting via the cli with "amplify add hosting":

➜ amplify add hosting
✔ Select the plugin module to execute · Hosting with Amplify Console (Managed hosting with custom domains, Continuous deployment)
? Choose a type Manual deployment

You can now publish your app using the following command:

Command: amplify publish

However, when then running "amplify publish", while the backend deployment passes without any issues, for the frontend deployment we get the following error:

✖ Deployment failed! Please report an issue on the Amplify Console GitHub issue tracker at https://github.com/aws-amplify/amplify-console/issues.
:octagonal_sign: Operation not supported. App is already connected a repository.

Expected behavior

amplify publish works and deploys the backend and frontend.

Reproduction steps

  1. Create an amplify application and add hosting through the amplify console by connecting the git repository
  2. Disconnect all the branches in the console (since there's no way to disconnect the repo)
  3. Run "amplify add hosting", choose "Hosting with Amplify Console" and "Manual deployment"
  4. Run "amplify publish"
  5. See error

Build Settings

No response

Log output

``` # amplify publish output ... Done in 16.39s. ✔ Zipping artifacts completed. ✖ Deployment failed! Please report an issue on the Amplify Console GitHub issue tracker at https://github.com/aws-amplify/amplify-console/issues. :octagonal_sign: Operation not supported. App is already connected a repository. Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the project identifier from: 'amplify diagnose --send-report' Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/ Session Identifier: 8722b71e-2bd2-46d6-ab33-ec17fce9ef90 :white_check_mark: Report saved: /tmp//report-1693310878055.zip ✔ Done Project Identifier: 809daeeb99aae0ff84c097e535188112 ```

Additional information

A similar issue was reported before and from the reactions I see there, it seems like a lot of people are confused that it was closed without a resolution: https://github.com/aws-amplify/amplify-hosting/issues/956

Jay2113 commented 1 year ago

Hi @hanna-becker 👋 , thanks for raising this and for sharing detailed information about your use case.

Unfortunately, we do not support the workflow of converting an existing git based CI/CD Amplify app to a manually deployed Amplify app.

The only workaround in this case would be to create a new Amplify app for your frontend to perform manual deployments and then maybe you can consider sharing your backend across apps: https://docs.aws.amazon.com/amplify/latest/userguide/reuse-backends.html

hanna-becker commented 1 year ago

Hi @Jay2113, thank you for the suggested workaround and the link. We will investigate this option.

So is it correct that there is currently no way to completely disconnect a repository from an Amplify app once it has been connected through the console? I think there should have been clear communication in the form of a big red warning box in the docs that taking this step is a one-way door that cannot be undone. (There may be now, actually, I haven't checked.)

I also wonder why this gap hasn't been closed, yet, by the Amplify team. I might be mislead, but from a user's perspective it doesn't seem like it would be a terribly large development effort to implement allowing users to disconnect their repositories.

hanna-becker commented 10 months ago

Hi @Jay2113, one question about your suggested approach: If we create a new app that reuses the existing backend, will we be able to delete the old app afterward, while keeping the original backend?