amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

Headless amplify pull without modifying the backend

Open MrHertal opened this issue 4 years ago • 11 comments

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.

MrHertal avatar Sep 08 '20 15:09 MrHertal

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.

jlecren avatar Oct 13 '20 14:10 jlecren

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

TTCole avatar Nov 05 '20 16:11 TTCole

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

hbj avatar Nov 09 '20 15:11 hbj

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.

zirkelc avatar Apr 12 '21 09:04 zirkelc

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

PatrykMilewski avatar Jul 14 '21 06:07 PatrykMilewski

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

spavuluri avatar Jul 22 '21 21:07 spavuluri

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

gakinson avatar Nov 01 '21 16:11 gakinson

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

timatperfectco avatar May 20 '22 20:05 timatperfectco

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

InnovateWithEric avatar Aug 10 '22 21:08 InnovateWithEric

@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.

amitchaudhary140 avatar Jan 01 '24 12:01 amitchaudhary140

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?

Stewartarmbrecht avatar Mar 23 '24 13:03 Stewartarmbrecht