aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
461 stars 116 forks source link

CLI feature flags are ignored in the console build #3950

Open DeezNutz2 opened 4 months ago

DeezNutz2 commented 4 months ago

How did you install the Amplify CLI?

No response

If applicable, what version of Node.js are you using?

No response

Amplify CLI Version

12.12.4

What operating system are you using?

Amazon Linux 2 (via console)

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No

Describe the bug

The solution provided here https://github.com/aws-amplify/amplify-category-api/issues/2636 is to add features.graphqltransformer.subscriptionsInheritPrimaryAuth = true to cli.json.

Adding this (along with a schema whitespace change and adding some useless fields to be extra-sure) with amplify version 12.12.4 does not work if you just check it in and let console do a push.

You have to run "amplify push" from a computer.

Is there a way to pass this variable that un-bricks my app to the "amplifyPush --simple" command in my amplify.yml?

Also, since this undocumented breaking change seems to be breaking customer prod apps, will the COE be public?

Expected behavior

The solution provided should work in Amplify console

Reproduction steps

Redundant

Project Identifier

No response

Log output

``` # Put your logs below this line ```

Additional information

No response

Before submitting, please confirm:

AnilMaktala commented 4 months ago

Hey @DeezNutz2, Thanks for raising this. We are investigating this issue and will keep you posted on updates.

palpatim commented 4 months ago

Hi @DeezNutz2,

Do you have an Amplify app ID so we can troubleshoot exactly what commands are being executed during the build? What appears to be happening is that the cli.json is being overwritten during the build system's init/pull phase.

As you identified, the workaround for now is to do an amplify push for each branch and environment that you are building in CI/CD. That will sync the cli.json to the Amplify deployment bucket in S3. From then on, the cli.json file that the Hosting build system pulls from the Amplify deployment bucket will correctly have the feature flag enabled.

--T

DeezNutz2 commented 3 months ago

app id is d5i79jkckfr0q we currently use a version of cli that is prior to this breaking change in ticket 2636.

we install jq to work around the cli's buggy handling of team-provider-info.json when it has more than like three or four backends.

        preBuild:
          commands:
            - echo "THIS IS THE GIT VERSION OF amplify.yml"
            - npm install -g typescript
            - yum install jq -y
            - which jq
            - pwd
            - ls
            - cat ../backend/amplify/team-provider-info.json
            - jq {"${USER_BRANCH}"} ../backend/amplify/team-provider-info.json
            - jq {"${USER_BRANCH}"} ../backend/amplify/team-provider-info.json > temp.json
            - cat temp.json
            - cat temp.json > amplify/team-provider-info.json
            - cat amplify/team-provider-info.json
            - echo "env"
            - env
        build:
          commands:
            - '# Execute Amplify CLI with the helper script'
            - amplifyPush --simple

As you identified, the workaround for now is to [ manually update every environment ]

Is this supposed to work without manually updating every environment or should this work from console?

Will the COE for 2636 be made public, as it broke builds for a lot of customers in prod?

DeezNutz2 commented 2 months ago

Guys, was that enough information?