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

Cannot Pull Amplify Project that has symlink the #current-cloud-backend in deployment bucket #13463

Closed
2 tasks done
ottinochris opened this issue Dec 7, 2023 · 9 comments
Closed
2 tasks done
Labels
pending-triage Issue is pending triage platform-pull Issues related to `amplify pull`

Comments

@ottinochris
Copy link

How did you install the Amplify CLI?

npm

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

v18.18.2

Amplify CLI Version

12.8.2

What operating system are you using?

Mac

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

I have tried to download the #current-cloud-backend.zip. Remove the symlink, zip and re-upload.

Describe the bug

I have a situation where I leverage Prisma in a lambda layer. It was working well and I was able to push until I had someone else try and pull then I would get an error saying that the symlink does not exist. Specifically ENOENT: no such file or directory, stat {path to symlink}

The error is similar to this issues #2948.

What I tried to do is delete the amplify directory for the backend of the project, download the #current-cloud-backend.zip, remove the symlink, zip the directory back up, and then add it back into S3. However when I do this and try to pull I get a messaging asking me to get credentials, then I'm routed to Amplify Studio, where selecting the environment is stuck in a loop.

If I add the original #current-cloud-backup.zip back to S3 then it resolves the amplify studio env selection issue (both for directory logging in or if prompted for credentials) but then obviously I'm back to the original symlink based pulling issue.

Expected behavior

I should be able to remove the amplify directory from my project, do amplify pull and it pull in the backend.

Reproduction steps

Initialize a project.

Create a lambda layer with a symlink

do an amplify push

try and do an amplify pull and the issue will start showing up

bonus: delete the amplify directory locally and still pulling will fail

Project Identifier

Can't do this since there is no backend project folders locally anymore.

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • 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.
@ottinochris ottinochris added the pending-triage Issue is pending triage label Dec 7, 2023
@ykethan
Copy link
Member

ykethan commented Dec 8, 2023

Hey @ottinochri, thank you for reaching out. Wanted to get some information on the changes made to the current-cloud-backend.
Are the changes similar to steps detailed here ?

Could you try to temporarily disable studio on the AWS Amplify console, which should switch to your AWS profile configured locally, then run the pull command with --debug command?

@ykethan ykethan added pending-response Issue is pending response from the issue author platform-pull Issues related to `amplify pull` labels Dec 8, 2023
@ottinochris
Copy link
Author

ottinochris commented Dec 11, 2023

@ykethan as of now, I just drop in the original current-cloud-backend zip so that I am able to log into amplify studio OR attempt an 'amplify pull' When I do the pull now (since my backend has been completely removed locally) it just says ENOENT: no such file or directory, stat <path to offending file in the .temp directory that no longer exists) I'm essentially stuck in a loop between not being able to pull when the original archive is in place because of the symlink, then if I remove the offending file and zip the directory back up for s3, then amplify studio cannot find the environment.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Dec 11, 2023
@ottinochris
Copy link
Author

ottinochris commented Dec 11, 2023

Working with AWS Support I now see File at path: '/amplify/#current-cloud-backend/amplify-meta.json' does not exist. This is a new error, with the original #current-cloud-backend file in place (that has the symlink.) I've tried to fix this by dropping in the #current-cloud-backend copied from the s3 bucket so they match, but no luck.

@ykethan
Copy link
Member

ykethan commented Dec 11, 2023

Hey @ottinochris, from the error it appears the #current-cloud-backend.zip may not have amplify-meta.json file , could verify the if the zip does have amplify-meta.json at the root?
if not, create a copy of #current-cloud-backend.zip as backup,
unzip the #current-cloud-backend.zip, then add the local copy of amplify-meta.json at the root or use the file present at the root of the deployment bucket if you do not have a local copy, zip the #current-cloud-backend.zip and upload it. while zipping do ensure current-cloud-backend is not being zipped as a nested folder

image

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Dec 11, 2023
@ottinochris
Copy link
Author

I have verified that there is amplify-meta.json in the #current-cloud-backend.zip that exists within the deployment bucket. The error is referencing my local env. What I have tried to do is pull down the #current-cloud-backup. Unzip it and add it to my amplify directory locally to ensure they are the same, then re-run amplify pull. When I do that I see 'ProjectNotInitializedError: No Amplify backend project files detected within this folder.'

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Dec 11, 2023
@ykethan
Copy link
Member

ykethan commented Dec 12, 2023

@ottinochris as a quick test, could try pulling the project into a new empty folder outside the existing project directory using amplify pull --appId <app-id> --envName <env-name>. Are you able to pull the backend or receive a similar error message?

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Dec 12, 2023
@ottinochris
Copy link
Author

@ykethan so I was actually able to resolve the pull by removing the sim links and zipping the archive in the way [Etep15] recommended in the issue you linked. Once I was able to pull in the environment again, I just added a script to the main package.json that builds the layer with a --no-bin-links flag so the symlink won't be generated again. Looks to be working again.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Dec 12, 2023
@ykethan
Copy link
Member

ykethan commented Dec 13, 2023

@ottinochris glad to hear that you were able to mitigate the issue.
Closing the issue, please feel free in reaching out to us for any assistance.

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2023
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.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-triage Issue is pending triage platform-pull Issues related to `amplify pull`
Projects
None yet
Development

No branches or pull requests

2 participants