aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.81k stars 821 forks source link

Headless amplify pull without modifying the backend #5275

Open MrHertal opened 4 years ago

MrHertal commented 4 years ago

Note: If your feature-request is regarding the AWS Amplify Console service, please log it in the official AWS Amplify Console forum

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

There seems to be no way to answer No to the question: Do you plan on modifying this backend? When running headless amplify pull.

I find this annoying in the case of React Native app CI/CD building scripts. I want to build my app on git push, so I need to include the aws-exports.js file which I don't have in the git repo. This feature would allow me to retrieve the amplify project meta data only, in the building script, without updating the project in the cloud.

Describe the solution you'd like I would like a new argument to the headless amplify pull (https://docs.amplify.aws/cli/usage/headless#amplify-pull-parameters) that answers Yes or No to the question: Do you plan on modifying this backend?

Describe alternatives you've considered I can still commit the aws-exports.js file, but it's really annoying when working with teammates on several environments. The solution I am considering is to host the aws-exports.js files somewhere and download them with a curl in the CI/CD scripts. But that would mean updating those files when amplify project is updated.

jlecren commented 4 years ago

It would be very nice to have feature! I separated the backend from the frontend to speed up the build process but I can't prevent the CLI in headless mode to update the backend environment in my frontend project.

TTCole commented 3 years ago

The inability to answer no to this question also affects regular old CLI use cases. If I run amplify pull on a new app, it takes me through the questions. I can watch the amplify folder get created and review the metadata that's in there while it's running. As soon as I answer 'no' to the 'Do you plan on modifying the backend? question -- the amplify folder is gone.

$ amplify --version 4.32.0

See attached images for the questions and list of files when I reach this question. The files go away after answering no.

AmplifyPullNotWorking_Files_20201105 AmplifyPullNotWorking_20201105
hbj commented 3 years ago

This would be very helpful and for now I'm working around this by changing the call to amplify in the sample script in https://docs.amplify.aws/cli/usage/headless#amplify-pull-parameters with:

echo n | amplify pull \
--amplify $AMPLIFY \
--frontend $FRONTEND \
--providers $PROVIDERS
zirkelc commented 3 years ago

This would be very helpful and for now I'm working around this by changing the call to amplify in the sample script in https://docs.amplify.aws/cli/usage/headless#amplify-pull-parameters with:

echo n | amplify pull \
--amplify $AMPLIFY \
--frontend $FRONTEND \
--providers $PROVIDERS

That worked for me as well. However, it would be nice to introduce another option to set a default for the backend question as well.

PatrykMilewski commented 3 years ago

Bump, since it's also an issue for me and doing echo n | works, but it's not most reliable way

spavuluri commented 3 years ago

+1 for a parameter to be able to do a headless amplify pull without modifying the backend.

gakinson commented 2 years ago

+1 for this. Any update on prioritization of this feature?

timatperfectco commented 2 years ago

mysterious miss here... yes please, make this question equivalent to every other one in that it can be specified explicitly in headless invocation :)

InnovateWithEric commented 2 years ago

Contributor PR to address this: https://github.com/aws-amplify/amplify-cli/pull/8804

amitchaudhary140 commented 9 months ago

@Straubulous Is there any recent change in the amplify cli where it no longer asks "Do you plan on modifying backend? " question. Because for me it pulls up the whole backend folder.

Stewartarmbrecht commented 7 months ago

Just curious, is there a way to setup CI/CD for an amplify backend without this? It seems like it is impossible to deploy changes to an existing backend. Amplify init headless throws this error:

An error occurred when creating the CloudFormation stack
🛑 Stack [amplify-mysolutionbackend-prod-114433] already exists

And amplify pull overwrites your changes so you are not actually updating the backend. Is there a process to use that I am missing?