Skip to content
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

The Amplify app changed the platform without outside intervention #2208

Open
JZechy opened this issue Nov 7, 2024 · 8 comments
Open

The Amplify app changed the platform without outside intervention #2208

JZechy opened this issue Nov 7, 2024 · 8 comments
Labels
hosting Issue related to Amplify Hosting pending-community-response Issue is pending a response from the author or community pending-triage Incoming issues that need categorization question Question or confusion about some aspect of the product

Comments

@JZechy
Copy link

JZechy commented Nov 7, 2024

Environment information

"amplifyfinbobbohemikaamplifyapp26797FB3": {
      "Type": "AWS::Amplify::App",
      "Properties": {
        "BasicAuthConfig": {
          "EnableBasicAuth": false
        },
        "BuildSpec": "version: 1\nfrontend:\n  phases:\n    preBuild:\n      on-failure: CONTINUE\n      commands:\n        - npm ci\n    build:\n      on-failure: CONTINUE\n      commands:\n        - API_URL=$API_URL OLD_APP_URL=$OLD_APP_URL CONFIG_NAME=$CONFIG_NAME CLOUDFRONT_URL=$CLOUDFRONT_URL ENVIROMENT=$ENVIROMENT npm run generate\n  artifacts:\n    baseDirectory: .output/public\n    files:\n      - \"**/*\"\n  cache:\n    paths:\n      - node_modules/**/*\n",
        "CustomRules": [
          {
            "Source": "/<*>",
            "Status": "404-200",
            "Target": "/index.html"
          },
          {
            "Source": "</^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/>",
            "Status": "200",
            "Target": "/index.html"
          }
        ],
        "EnvironmentVariables": [
          {
            "Name": "CONFIG_NAME",
            "Value": "bsf"
          }
        ],
        "IAMServiceRole": {
          "Fn::GetAtt": [
            "amplifyfinbobbohemikaamplifyappRole33D84F09",
            "Arn"
          ]
        },
        "Name": "FinBOB-Bohemika",
        "OauthToken": {
          "Fn::Join": [
            "",
            [
              "{{resolve:secretsmanager:",
              {
                "Ref": "SsmParameterValuefinbobsecretgithuboauthC96584B6F00A464EAD1953AFF4B05118Parameter"
              },
              ":SecretString:::}}"
            ]
          ]
        },
        "Platform": "WEB",
        "Repository": "https://github.com/Bohemika-eu/bsf"
      },
      "Metadata": {
        "aws:cdk:path": "finbob-bohemika/running-environments/deployment-support/amplify/finbob-bohemika/amplify-app/Resource"
      }
    }

Describe the bug

We have AWS Amplify Applicationm described by Infrastrcture as Code through AWS CDK. We created the application with platform WEB, because we are using a static site generator. How the application was created and how it is still described in the CloudFormation stack can be seen in Environment Information.

This was perfectly fine until our application switched to the WEB_COMPUTE platform on its own today. Nothing has changed in the CDK code, the application is still described in CloudFormation as above. Other users do not have permission to change the application settings, and at the same time no one could - The option to switch platforms is simply not available in the interface.

This is critical behaviour for us.
We can't simply switch our workflow to SSR to use WEB_COMPUTE. And this change is now blocking our deployments, because obviously a different output is expected. We need to transition our platform back.

I would like to add that such critical arbitrary changes are not happening for the first time in a new application backend. When updates to the functionality of the Production Branch settings has been applied, our production branch was automatically switched to the development branch. As a result, the end users got a completely bad environment that was in operation for several hours.

Reproduction steps

No steps to reproduce.

@JZechy JZechy added the pending-triage Incoming issues that need categorization label Nov 7, 2024
@JZechy JZechy changed the title [CRITICAL] The Amplify app changed the platform without outside intervention The Amplify app changed the platform without outside intervention Nov 7, 2024
@JZechy
Copy link
Author

JZechy commented Nov 7, 2024

AWS CLI amplify update-app command has worked for the change. Yet it is unfortunate these background changes are happening.

@ykethan ykethan added the hosting Issue related to Amplify Hosting label Nov 7, 2024
@Jay2113
Copy link

Jay2113 commented Nov 8, 2024

Hi @JZechy 👋 , thanks for reaching out. As a first step, I'd recommend reviewing the UpdateApp API calls in CloudTrail that may have occurred for the app when this issue first surfaced. This should be a good starting point to debug how/why the app's platform changed to WEB_COMPUTE.

@Jay2113 Jay2113 added the pending-response Issue is pending response from author label Nov 8, 2024
@JZechy
Copy link
Author

JZechy commented Nov 15, 2024

@Jay2113 Examined the CloudTrail for Amplify and UpdateApp call during Thursday 6th, and Friday 7th November. Where the Amplify changed its platform, and when I turned it back.

Let me start with the AWS CLI when I turned the Amplify's platform back. In the event record we can find that I send in the request parameters about the appId and platform. Leading to a change of application's platform as expected. If someone is changing the application's platform, we will see it in the parameters.

{
    "requestParameters": {
        "appId": "***",
        "platform": "WEB"
    },
}

Now, let's take a look at Thursday 6th, where our Frontend team lead was making some changed to the deployment. The first request that day contains these parameters about some chnage to buildspec of the application.

{
    "requestParameters": {
        "appId": "***",
        "buildSpec": "***"
    },
}

Amplify API responded with App's platform still set to WEB. That was ok. Second API call was about changing the environment variables.

{
    "requestParameters": {
        "environmentVariables": "***",
        "appId": "***"
    },
}

This second call send a response from Amplify, which was already telling the App's platform is WEB_COMPUTE. So the platform somehow changed by itself, because no UpdateApp call contains the Platform parameter in request. Also I can see via logged AccessKeyId that both calls was made by our frontend developer only from the Amplify Console, where is impossible to change the platform.

It is leading me still to same suspicion: The platform was not changed on our behalf.

@github-actions github-actions bot removed the pending-response Issue is pending response from author label Nov 15, 2024
@Jay2113
Copy link

Jay2113 commented Nov 18, 2024

@JZechy thank for you reviewing the CloudTrail event logs and for sharing that information. As next steps, can you share your Amplify app id along with the branch name and build # where you observed this issue?

@Jay2113 Jay2113 added pending-response Issue is pending response from author pending-community-response Issue is pending a response from the author or community and removed pending-response Issue is pending response from author labels Nov 18, 2024
@Jay2113
Copy link

Jay2113 commented Nov 25, 2024

@JZechy 👋 , following up to see if can you share the previously requested information: #2208 (comment)?

@Jay2113 Jay2113 added question Question or confusion about some aspect of the product and removed pending-triage Incoming issues that need categorization labels Nov 25, 2024
@JZechy
Copy link
Author

JZechy commented Nov 26, 2024

@Jay2113 Hi! I am sorry for the delay. Here is the details:

  • AppId digrkgojklkln
  • Branch name env/test
  • Build # 204

@rv-kbennardo
Copy link

rv-kbennardo commented Dec 11, 2024

Following! Same thing happened to us recently!

@ykethan ykethan added the pending-triage Incoming issues that need categorization label Dec 11, 2024
@rv-kbennardo
Copy link

rv-kbennardo commented Dec 18, 2024

Hello! 👋🏼 Confirming we've found that branches pushed to Amplify with a fresh npm install have caused this issue for us (ie. platform setting randomly changes from WEB to WEB_COMPUTE -- we are running an AWS console command to manually change it back to WEB when this happens.

We are an Nuxt app with ssr: false and target: static set, but I've found if we explicitly add: nitro: { preset: 'static' } to our nuxt config, the Amplify setting remains set to WEB, otherwise, it'll automatically update to WEB_COMPUTE. This started happening for us around Dec. 9th, not sure why all of a sudden it would occur, unless there were Nitro patches that were updated on the fresh npm install that now require us to be extra explicit.

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hosting Issue related to Amplify Hosting pending-community-response Issue is pending a response from the author or community pending-triage Incoming issues that need categorization question Question or confusion about some aspect of the product
Projects
None yet
Development

No branches or pull requests

4 participants