-
Notifications
You must be signed in to change notification settings - Fork 825
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 does not recognize function created in a separate git branch #8090
Comments
I found a solution, but I still would like someone to help me understand if this is okay and also tell me what are best practices to avoid finding ourselves in this kind of situation. When I merged the branch with all the changes (including the result of the merge) into a test branch which has an automated build associated to it, it worked, i.e. it created the missing function (funB). Is there any reason why the amplify cloud build worked and the local amplify push via CLI didn't? |
Hey @cfbo 👋 apologies for the delay, but thank you for taking the time to file this and include detailed reproduction steps! I was able to reproduce by creating a similar setup with two separate environments, in two separate local directories, both connected to separate git branches corresponding to their envs. In each branch I created a function, pushed to Amplify, then pushed to git. In the "main" branch & env I ran a These conflicts are described as the following:
Since neither Amplify env existed in the other, this is where those conflicts arise. Though unfortunately I experienced the same issue where now the new function does not show in the list of resources for the current env, I was able to run Marking this as a feature request to the team to improve the multi-environment flow when merging content from a separate branch with new, alike resources. |
@josefaidt Thanks for coming back to me and taking the time to reproduce the scenario. If understood correctly, a workaround is the following: when merging branch 2 into branch 1 and while amplify is on envA, after resolving the git conflicts we should also run an I will add something that is sort of related to merging into new branches/env, but should probably go in a separate ticket |
Apologies for the confusion, after resolving git conflicts we want to run checkout on the current env. In this case while we are on
Yes I've noticed this recently as well, may you open a separate issue? I'll add my notes to that issue as well, as I've noticed it will add that block when updating a function if it has secrets enabled. |
Which Category is your question related to?
Function
Amplify CLI Version
5.3.1
What AWS Services are you utilizing?
Api, function, storage, auth,
Provide additional details e.g. code snippets
Help needed with an amplify push issue, please! 🙏
amplify push
in each one env and did git pushes while progressing work.amplify push
, which worked successfully.amplify status
does not list my colleague's function (funB)... of course it was available in the backend-config.json and the related folder under amplify/function was there. Therefore my env (envA) did not build that lambda in the cloud.. and of course this causes errors (the lambda is invoked by the react frontend but it's not there)I don't know how to get out from that situation!
What is the correct procedure to handle such scenario??
Should I have used an amplify command to merge envB in envA? Shouldn't be enough the git merge and then a push?
Some more attempts on that:
amplify add function
to manually create the missing function (funY)... I noticed that after this, funY was added to my env (envA) in the team-provider-info.json. Of course the folder for funY was already in my amplify folder and amplify kept that.. it did just override some files (e.g. adding basic permissions for that function and removing the permission my colleague had assigned to it).. so I then inspected the diff in git and made sure to (very carefully) discard some of the changes made by the amplify add the original settings from my colleague. However performing another amplify push at this point, I got an error...The text was updated successfully, but these errors were encountered: