-
Notifications
You must be signed in to change notification settings - Fork 819
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
amplify env add/checkout change underlying file structure in unpredictable ways. #9116
Comments
Hey @eettaa,
The |
Hi @jhockett, thanks so much for your response! Yes, totally acknowledge that
Does this mean Amplify makes no promises about what's going on in these directories i.e. "as a user you shouldn't try to understand this?" Even if I don't need to worry about it for VC reasons, I'm still sort of curious to understand Amplify at a deeper level. But I understand if you don't have time to answer questions that don't pose immediate problems to your users. Thanks Again! |
@eettaa apologies for taking so long to get back to you initially and thanks for clarifying what you were asking. The reason If you want a blank environment, you would need to run |
Hi @jhockett, thanks for the extra info.
This makes sense to me when a new environment is created (and it matches my expectation as stated in "bug" 1). But what I do not understand is why
Current behavior at the end of this flow seems to be that The fact that in "bug" 2 I would expect * In reality, Thanks for helping me understand these intricacies- my team is excited to be learning about Amplify |
This sounds correct to me given the steps you laid out. Can you share the Does |
@jhockett thanks so much for your comment. In order to be extra explicit, I've removed the amplify files from my Please note that this is exactly the process I used when formulating my initial question, so you'll see these results map exactly onto my original post (except that I do not include "Bug" 3 here as we can already identify problems at 2). Starting Case (before bug one):
After
Note in particular that for some reason
For good measure, we can also see that
Moving on to "Bug" 2, which you asked about in your most recent comment:
Given the above dump and our (shared) expectations from the previous posts:
I think we can conclude that these operations do not match our expectations? I did subsequently run My observations:
Thank you for your continued troubleshooting. |
@eettaa thanks so much for the detailed write-up, this is super useful! I will share with the team and get back to you. |
@jhockett Great, thank you! Please do let me know what they say as this is blocking our (mult-dev) org from adopting amplify environments. |
@danielleadams happy new year, just want to circle back here in case there was any new guidance. |
@eettaa apologies for the late response here - is this still an issue for you? |
Hi @danielleadams, thanks for circling back! Would love any insight the amplify team can provide :) |
Hey @eettaa 👋 apologies for the delay here! Thank you for including the details of the issues you're experiencing with the multi-environment workflow. Currently this workflow relies heavily on git, and as such the CLI will not retain state of the filesystem between environments. Some of these issues are documented separately as bugs/features to ultimately improve the multi-env workflow
I'll close this issue for now in favor of tracking the existing items noted above, however if you feel these issues do not quite cover the case you're actively experiencing, please reply back to this thread or file a new issue. |
Before opening, please confirm:
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v14.18.1
Amplify CLI Version
7.5.3
What operating system are you using?
Ubuntu 18.04.5 LTS
Amplify Categories
Not applicable
Amplify Commands
env
Describe the bug
I am struggling to understand what is actually expected to happen under the hood for
amplify env add
andamplify env checkout X
. It matters to me because many of these files are version-controlled (as Amplify recommends) and therefore I need to understand what file changes should be expected in pull requests with environment interaction.The files that seem to change do not match my understanding after reading the documentation I could find. Can someone help me understand why amplify's behavior makes sense (or confirm my thought that it does not?).
Starting case: Env 'envone' with auth, lambda (one function called functionone), api enabled. envone is pushed to cloud and re-pulled, amplify status says 'no update'
"Bug" one:
amplify env add envtwo
Expected:
#current-cloud-backend/
is updated to be almost empty (no categories enabled).backend/
is unchanged. Amplify status says "create" for auth, api, lambda.Justification: creating a new environment is not meant to update the local backend in
backend/
. The new environment has no categories enabled, so#current-cloud-backend/
should not have categories. Status shows the difference between these two states.Actual:
#current-cloud-backend/
retains all the categories from envone. The twoamplify-meta.json
files (one in#current-cloud-backend/
and one inbackend/
) are updated. Amplify status says "create api, auth, functionone"... Next, let's remove our local changes:
"Bug" two:
amplify env pull --restore
Expected: all
backend/
categories are deleted. amplify status now has no entries.Justification: there should be no backend categories in #current-cloud-backend, and this should be copied over into
backend/
Actual: amplify status as expected. but
backend/
retains all the categories from envone, just as#current-cloud-backend/
retained the categories while adding the new environment.If you then run
amplify push
, you get a message saying "this is up to date" i.e. no push is needed. No underlying files change.... Next, let's add a new functiontwo to envtwo:
amplify add function ....
// defaults are fine, name the function functiontwoamplify status
runs as expected: functiontwo designated as 'create'amplify push
// seems to work as expected. I note that after this stage,#current-cloud-backend/
has afunction/functiontwo/
directory. This is strange as the previousamplify push
on the fresh environment did not update (remove)#current-cloud-backend/
directories..... Next, let's switch back to envone:
"Bug" 3:
amplify env checkout envone
Expected:
#current-cloud-backend/
is modified to remove functiontwo. I would expect it to add back in the three categories that might have been removed as part of "bug" 1, but since they weren't, no change there. Nobackend/
change. amplify status shows: functiontwo: create, functionone: delete, api: delete, auth: delete.Justification: envtwo has only functiontwo.
backend/
doesn't change withamplify env checkout
. therefore, the difference should be that functiontwo would be created and the other components would be deleted.Actual:
#current-cloud-backend/
is modified to remove functiontwo. Amplify status says functiontwo: Create, unctionone: no change, api: no change, auth: no change.What is especially confusing to me is the apparent discrepancy between "bugs" 1 and 3, where adding an empty environment does not remove
#current-cloud-backend/
contents but checking out envone again does remove#current-cloud-backend/functiontwo/
directories.I assume that the above behavior is intentional, that my perceived "bugs" are not really bugs, and my understanding of expected
#current-cloud-backend/
andbackend/
changes is incorrect somehow. However, I cannot find any documentation on file changes for these commands. Can anyone offer insight?Expected behavior
(as described above)
Reproduction steps
(as described above)
GraphQL schema(s)
(irrelevant, this behavior would occur with only e.g. lambda functions enabled)
Log output
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: