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

AppId mismatch failure in preview build of backend used across apps #13973

Open
Ruci0094 opened this issue Oct 14, 2024 · 9 comments
Open

AppId mismatch failure in preview build of backend used across apps #13973

Ruci0094 opened this issue Oct 14, 2024 · 9 comments
Labels
hosting Issues tied to hosting category pending-triage Issue is pending triage platform-push Issues related to `amplify push` question General question

Comments

@Ruci0094
Copy link

Ruci0094 commented Oct 14, 2024

Amplify CLI Version

latest (12.13.0)

Overview

We have several apps, assuming their appIds are A and B.
App A is not actively used anymore, but we still uses the backend resources associated to AppId A. Therefore, even though we interact with B when we configure preview builds, our code's team-provider-info.json has appId = A.
With #13954, it started to fails with AppId mismatch which checks the appId from meta and appId from commandline.

Questions

Considering it's possible to use Amplify backends across apps, I feel it's possible that AppId of the app on console does not match with appId retrieved from metafiles (which is for backend, IIUC).

  • When backend is used across apps, is it WAI that this error is thrown or does it come from our misconfiguration? Any idea on where to fix?
  • I assume removing appId from commandline can be a workaround but I'm not sure where we configure that. Do you have any pointer?

Trace


2024-10-10T14:01:17.716Z [INFO]: �[0mAmplify AppID found: <APPID OF APP B>. Amplify App name is: <APP NAME OF APP B>�[0m

2024-10-10T14:01:17.770Z [INFO]: �[0mBackend environment stg found in Amplify Console app: <APP NAME OF APP B>�[0m

2024-10-10T14:01:19.921Z [WARNING]: - Fetching updates to backend environment:XXXs from the cloud.

2024-10-10T14:01:21.503Z [WARNING]: - Building resource api/XXXX

...

2024-10-10T14:01:24.592Z [WARNING]: ✔ Successfully pulled backend environment XXX from the cloud.

2024-10-10T14:01:25.190Z [INFO]: ✅

2024-10-10T14:01:27.372Z [INFO]: 🛑 Amplify appId mismatch.

2024-10-10T14:01:27.372Z [INFO]: Resolution: You are currently working in the amplify project with Id <APPID OF APP A>
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/
@Ruci0094 Ruci0094 added pending-triage Issue is pending triage question General question labels Oct 14, 2024
@felixpro
Copy link

felixpro commented Oct 14, 2024

The same thing is happening to me. Is there any update?

@ykethan
Copy link
Member

ykethan commented Oct 15, 2024

Hey folks, thank you for reaching. Could you provide us some additional on the reproduction steps?
Are you running into this when associating an existing backend app to a frontend app using the console branch edit button?
https://docs.aws.amazon.com/amplify/latest/userguide/reuse-backends.html#reuse-backends-edit-existing

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Oct 15, 2024
@felixpro
Copy link

felixpro commented Oct 16, 2024

The problem is related to the preview generation. They were working fine and suddenly started throwing an error.

In my case, I have two apps, and App A uses the backend from App B. For some reason, the PR previews for App A stopped working due to the error. 🛑 Amplify appId mismatch.

Screenshot 2024-10-15 at 10 41 15 PM

Here is the error:

Screenshot 2024-10-15 at 11 11 53 PM

@Ruci0094
Copy link
Author

Hi @ykethan, thank you for checking. The situation is exactly what first comment and @felixpro describes. Just to clarify, it is as follows:

Overview

We have two apps: A and B.
We use app B to trigger preview deploy of frontend for Github branch.
However, our team-provider-info.json has AmplifyAppId = A because we use the backend associated to the app A.
It has been working fine until recently, but suddenly deploy preview started to fail with AppId mismatch. It corresponds with the release of 12.13.0

So repro steps would be:

  1. Create initial app A
  2. Create second app B and Follow https://docs.aws.amazon.com/amplify/latest/userguide/reuse-backends.html#reuse-backends-create-connect to connect to backend of app A
  3. Set up deploy preview of app B
  4. Trigger deploy preview and it fails

short-term workaround

Going to app > Hosting > Build Configuration > Build Image Configuration and pin the Amplify CLI version as 12.12.6

Why workaround is not desirable

We need to pin the CLI version and never be able to catch up with the latest

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Oct 16, 2024
@ykethan
Copy link
Member

ykethan commented Oct 16, 2024

@felixpro @Ruci0094 thank you for the information. I was able to reproduce the issue by adding the amplify-meta.json file to my git repository.
Could you confirm if the repository currently does have the amplify-meta.json file present under the amplify/backend?
to note the amplify-meta.json should be .gitignored, refer to the amplify-meta and .gitignore documentation providing this information.

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Oct 16, 2024
@Ruci0094
Copy link
Author

Could you confirm if the repository currently does have the amplify-meta.json file present under the amplify/backend?

No, amplify-meta.json is .gitignored so we don't see that file in the repo. I assume it is generated in the build of deploy preview, maybe?

スクリーンショット 2024-10-17 8 17 39

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Oct 16, 2024
@felixpro
Copy link

Same as Ruci0094, amplify-meta is ignored in my repo.
Screenshot 2024-10-16 at 9 57 20 PM

@ykethan
Copy link
Member

ykethan commented Oct 17, 2024

thank you for the confirmation on the gitignore. On a quick check with Amplify team, they suggest verifying your version control system as while the file maybe gitignored for any changes the file may have been pushed/committed to the repository previously.
tried reprod

Additionally, if the file is indeed not present version control system would be happy in diving into the issue over a call. I am available on discord and my handle is ykethan

@ykethan ykethan added hosting Issues tied to hosting category pending-response Issue is pending response from the issue author platform-push Issues related to `amplify push` labels Oct 17, 2024
@Ruci0094
Copy link
Author

スクリーンショット 2024-10-18 18 43 58

Thank you, I double confirmed that there is no meta file in the repo.
I sent you a friend request on discord. (I'm not familiar with discord so let me know if I do something weird). I'm on JST (+09:00) and available on Oct.18 16:30 ~ 18:30 PDT so if you happen to have time, please ping me. We can discuss other schedule further on discord or I'm happy to share whatever information you need asynchronously if it's hard to find an overlapping slot.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hosting Issues tied to hosting category pending-triage Issue is pending triage platform-push Issues related to `amplify push` question General question
Projects
None yet
Development

No branches or pull requests

3 participants