Amplify-cli: Diffs between code in git repo and code retrieved by amplify pull

Created on 10 Jul 2020  路  10Comments  路  Source: aws-amplify/amplify-cli

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

Running amplify pull (or amplify env checkout <env> --restore or amplify env pull) results in changes due to white space. Very annoying for comparing diffs and working in a cicd workflow.

Seems to primarily affect functions. Using amplify function add generates a cloudformation template where spaces are used. After deploying the function with amplify push, a subsequent amplify pull replaces the source code with a template that uses tabs for white space! There tend to be a handful of other changes as well, as if the template json was prettified.

bug functions not-reproducable pending-response

All 10 comments

Hi @lorengordon what version of the CLI are you using? You can use amplify -v to find out.

@jhockett We started the project a week ago with v4.22.0 and updated to v4.23.0 a few days ago.

I think a cdk provider for amplify could also solve this (https://github.com/aws-amplify/amplify-cli/issues/171), since cdk-generated cfn templates would not need to be committed to the repo.

Hi @lorengordon, thanks for the bug report! I was able to reproduce this issue.

Thanks for confirming @jhockett. My workaround for now, is to use Amplify Console to manage all builds... Add team-provider-info.json to .gitignore and remove it from the repo, and coach contributors to _never_ run any variation of amplify push or amplify pull locally. Just let the branch builds and pr previews do the work...

@lorengordon could you please give it a try with the latest CLI version as I think this is fixed under the changes that involved uniform JSON read/write. I was not able to reproduce it with the latest version.

@attilah planning to be working with amplify again this weekend, so good timing! Will let you know

@attilah do you happen to know which pr might have fixed it? I don't see any linked references in this issue...

@attilah I think this is good now. There's still some pain if you used amplify pull in an earlier version and committed the code that used tabs as whitespace, because now another amplify pull with a more recent version will change them back to spaces. Figure it should be a one time conversion though, so that seems fine.

(I'm testing now with amplify v4.29.1... would still be nice to know which version changed the behavior...)

@lorengordon one PR I could call out is this: https://github.com/aws-amplify/amplify-cli/pull/5125 that added the state management classes and JSON utility classes. The functions is fixed by some other PR that utilizing the new functions. Closing the issue as it seems to be solved.

Was this page helpful?
0 / 5 - 0 ratings