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

Switching build image causes a different app ID to be used for GitHub app check #3809

Closed
5 tasks done
terrymun opened this issue Nov 17, 2023 · 8 comments
Closed
5 tasks done
Labels
archived This issue has been locked. pending-triage

Comments

@terrymun
Copy link

terrymun commented Nov 17, 2023

Before opening, please confirm:

  • I have checked to see if my question is addressed in the FAQ.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

App Id

d179m7yexeqiqu

AWS Region

eu-west-1

Amplify Hosting feature

Webhooks

Frontend framework

Next.js

Next.js version

14.0.3

Next.js router

App Router

Describe the bug

As part of the process to upgrade to next@14, we are switching the build image from Amazon Linux:2 to Amazing Linux:2023 as recommended, as it has [email protected] installed.

However it seems that the AWS Amplify Console Web Preview check that runs when a PR is created will use an incorrect app ID. Our app has an ID of d179m7yexeqiqu, but if the latest build image is used, the app ID switches to dbrvsu6zabdup in the check, which causes it to falsely report that the Preview deployment has failed as the app does not exist. The link shown at the bottom of the check indicates that an incorrect and unrelated app ID is used: https://console.aws.amazon.com/amplify/home?region=eu-west-1#/dbrvsu6zabdup/pr-880/1

The correct links should be https://console.aws.amazon.com/amplify/home?region=eu-west-1#/d179m7yexeqiqu/pr-880/1

Expected behavior

The link generated by AWS Amplify Console Web Preview uses an incorrect app ID, and the check will fail as the app does not exist.

Reproduction steps

  1. Switch the build image to something other than the default, e.g. to "Amazon Linux:2023"
  2. Create a PR
  3. Verify that "AWS Amplify Console Web Preview" check is running, and wait
  4. The check will fail and falsely report deployment has failed, as it uses an incorrect app ID to perform the check

Build Settings

version: '1.0'
frontend:
  phases:
    preBuild:
      commands:
        - yarn config set cacheFolder .yarn-cache
        - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 yarn install --immutable
    build:
      commands:
        - export NODE_OPTIONS=--max-old-space-size=4096
        - yarn nx run site:build:production --skip-nx-cache

  artifacts:
    baseDirectory: dist/packages/site/.next
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
      - .yarn-cache/**/*

Log output

No error messages are produced, and the error is coming from the GitHub check from the Amplify app.

Additional information

No response

@Narrator
Copy link
Contributor

Hello! Thanks for reaching out to us.

It seems like the same GitHub repository is connected to 2 different applications:

  • d179m7yexeqiqu (Account ID: 040963195180)
  • dbrvsu6zabdup (Account ID: 563876673670)

The pr-880 branch exists on both apps.

It is expected for both status checks to show up on PRs. Can you check the repository's webhook settings? There should be 2 webhooks configured with each one pointing to one of the app IDs.

The deployment on the dbrvsu6zabdup app ID is failing because it is not using the new build image.

@terrymun
Copy link
Author

Thanks for the quick reply @Narrator. I am curious about this other app, since I do not see it on the Amplify console at all and we have only created a single AWS App for our particular repo.

Also, why does switching build image cause the app ID to change?


I took a look at the webhook and there are 4 separate ones configured. Would you advise I nuke them and set them up again?

@Narrator
Copy link
Contributor

Narrator commented Nov 17, 2023

I do not see it on the Amplify console at all and we have only created a single AWS App for our particular repo.

Like I mentioned above, the other app belongs to an entirely different account ID - That's why you don't see the app in your current console.

Also, why does switching build image cause the app ID to change?

Switching the build image should not cause the app ID to change. What is likely happening is that you already have multiple webhooks (one for each app) setup with your repo and only one of them is failing and thus, surfacing in your PR status code.

However, if you believe that this is inaccurate, please share a screenshot of your status check panel - It will help us root cause the behavior!

I took a look at the webhook and there are 4 separate ones configured. Would you advise I nuke them and set them up again?

Can you please look at the actual webhook URLs? There should be a query parameter attached to each URL like so: ?appId=xxx. You should be able to identify the different app IDs this way.

You can go ahead and delete them if you want - But please make sure that you are deleting the correct one by validating the app ID.

@terrymun
Copy link
Author

terrymun commented Nov 17, 2023

@Narrator It seems like deleting the other webhooks and keeping the one with the correct app ID didn't work. Here is how the single webhook look like:

Screenshot 2023-11-17 at 11 10 36

And the status check is still showing an incorrect app ID:

Screenshot 2023-11-17 at 11 12 01

@Narrator
Copy link
Contributor

@terrymun I apologize for the confusion - The mechanism we use for PR status checks don't have to do with GitHub webhooks. Instead, we receive them via the GitHub app integration.

When we receive webhook calls from the GitHub app, we receive a repository URL, using which we look up all the associated app IDs to run a build and perform the status check for.

So when you have multiple apps in the same region attached to the same repository URL, then we kick off builds for each of those apps - However, we only publish a single status check for the region as a whole. So even though multiple status checks are being performed, we only publish one of them - This is a bug and we will take an action item for it.


However, the fact that your repository URL is attached to multiple apps is not going to prevent one of those from failing unless you update the secondary app to also use the new build image.

Otherwise, delete the app in the secondary account. You can also disable PR previews for the second app if you don't need it on the second app.

@terrymun
Copy link
Author

@Narrator Thanks for the clarification! I have managed to find the second Amplify App that was somehow connected to the same repo. Deleting that app worked (we don't use it anyway).

Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Copy link

This issue has been automatically locked.

@github-actions github-actions bot added the archived This issue has been locked. label Nov 18, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Nov 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. pending-triage
Projects
None yet
Development

No branches or pull requests

2 participants