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

New backend references resources from deleted backend with same name #13613

Closed
5 tasks done
adam-nygate opened this issue Jul 21, 2023 · 6 comments
Closed
5 tasks done
Labels
hosting Issues tied to hosting category pending-response Issue is pending response from the issue author pending-triage Issue is pending triage

Comments

@adam-nygate
Copy link

adam-nygate commented Jul 21, 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

d1dsr14iqx52pk

AWS Region

us-east-2

Amplify Hosting feature

Backend builds, Backend environments

Frontend framework

Vue

Next.js version

N/A

Next.js router

N/A

Describe the bug

The backend environment of a new environment references resources from a deleted backend with the same name.

Expected behavior

A new environment should not reference resources from a different environment, even an environment with the same name (that was deleted).

Reproduction steps

  1. Create a new environment called main
  2. Import an auth resource on this new environment (e.g auth1234abcd) and deploy it to the backend
  3. Delete the environment entirely
  4. Create another new environment with the same name (i.e main)
  5. Import the same auth resource on this new environment but with a different name (e.g. auth1234efgh) and deploy it to the backend (this will succeed)
  6. Make a change to the backend (e.g. add another resource) and let the automated builds deploy the change via the amplify-console.

See the logs for the failure details, I.e:

2023-07-21T18:34:30.250Z [INFO]: �[0mAmplify AppID found: xxx amplify App name is: xxx�[0m
2023-07-21T18:34:30.289Z [INFO]: �[0mBackend environment main found in Amplify Console app: xxx�[0m
2023-07-21T18:34:40.970Z [WARNING]: - Fetching updates to backend environment: main from the cloud.
2023-07-21T18:35:00.649Z [WARNING]: - Building resource api/xxx
2023-07-21T18:35:00.651Z [WARNING]: - Building resource auth/auth1234abcd
2023-07-21T18:35:00.698Z [WARNING]: ✔ Successfully pulled backend environment main from the cloud.
2023-07-21T18:35:01.419Z [WARNING]: ✖ There was an error initializing your environment.
2023-07-21T18:35:01.769Z [INFO]: 🛑 Could not initialize categories for 'main': The "path" argument must be of type string. Received undefined

^ note the auth resource being referenced is from the now non-existent environment.

Build Settings

backend:
  phases:
    build:
      commands:
        - envCache --set stackInfo ""
        - amplifyPush --simple

Log output

``` 2023-07-21T18:34:30.250Z [INFO]: �[0mAmplify AppID found: xxx amplify App name is: xxx�[0m 2023-07-21T18:34:30.289Z [INFO]: �[0mBackend environment main found in Amplify Console app: xxx�[0m 2023-07-21T18:34:40.970Z [WARNING]: - Fetching updates to backend environment: main from the cloud. 2023-07-21T18:35:00.649Z [WARNING]: - Building resource api/xxx 2023-07-21T18:35:00.651Z [WARNING]: - Building resource auth/auth1234abcd 2023-07-21T18:35:00.698Z [WARNING]: ✔ Successfully pulled backend environment main from the cloud. 2023-07-21T18:35:01.419Z [WARNING]: ✖ There was an error initializing your environment. 2023-07-21T18:35:01.769Z [INFO]: 🛑 Could not initialize categories for 'main': The "path" argument must be of type string. Received undefined ```

Additional information

I've tried instantiating the environment from local (i.e amplify add env && amplify push) and from amplify-console (setting up the branch and backend connection and then letting automated builds deploy the backend).

Initial deploys via the console work but subsequent deploys do not.
Local deploys always work (but don't meet our needs).

I've also verified that the envCache does not have references to the resources by accessing the pre-signed s3 object exposed in the builds env.

@adam-nygate adam-nygate added the pending-triage Issue is pending triage label Jul 21, 2023
@Jay2113
Copy link
Contributor

Jay2113 commented Feb 22, 2024

@adam-nygate 👋 , thanks for reaching out. Since the issue seems related to the amplify backend environment, I am going to transfer this to the amplify-cli repository for better assistance.

@Jay2113 Jay2113 transferred this issue from aws-amplify/amplify-hosting Feb 22, 2024
@Jay2113 Jay2113 added the transferred This issue was transferred from another Amplify project label Feb 22, 2024
@ykethan
Copy link
Member

ykethan commented Feb 26, 2024

Hey, wanted to get some additional information. how was the environment removed was this on the Amplify console or via amplify env remove main?

@ykethan ykethan added pending-response Issue is pending response from the issue author and removed transferred This issue was transferred from another Amplify project labels Feb 26, 2024
@adam-nygate
Copy link
Author

It was removed by the Amplify console

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

ykethan commented Feb 26, 2024

@adam-nygate thank you for the information. If the backend environment was deleted on console, we will need to remove the env references in the local Amplify cli by amplify env remove main.
But curious could you try adding the AMPLIFY_ENABLE_DEBUG_OUTPUT environment variable to Amplify console and re-attempt the build. Could you provide us the stack trace that gets printed.

@ykethan ykethan added hosting Issues tied to hosting category pending-response Issue is pending response from the issue author labels Feb 26, 2024
@ykethan
Copy link
Member

ykethan commented May 3, 2024

Closing the issue due to inactivity. Do reach out to us if you require any assistance.

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2024
Copy link

github-actions bot commented May 3, 2024

This issue is now closed. 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.

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-response Issue is pending response from the issue author pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

3 participants