amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

An error occured during the push operation: EEXIST: file already exists, symlink

Open mdebo opened this issue 6 years ago • 8 comments

Note: If your issue/bug is regarding the AWS Amplify Console service, please log it in the Amplify Console GitHub Issue Tracker

*Bug description I have a lambda function written in typescript. I have symlinked the src folder containing graphql autogenerated files. I'm not not able to pull backend or push. I receive this error:

➜ myProject git:(master) ✗ amplify push ✖ There was an error pulling the backend environment dev. An error occured during the push operation: EEXIST: file already exists, symlink '../../../../../src/graphql' -> '/Users/myUser/Projects/myProject/amplify/.temp/#current-cloud-backend/function/myProjectSyncParkings/lib/graphql'

Amplify CLI Version 4.2.0

Am I doing something wrong? Now I'm not able to do anything, unless i recreate from scratch the entire stack..

mdebo avatar Dec 08 '19 21:12 mdebo

UPDATE: I End up removing the symlink and recreate project from scratch, but now when doing amplify push i get this error when the cli try to get to pull :

✖ There was an error pulling the backend environment dev. EEXIST: file already exists, symlink '../loose-envify/cli.js' -> '/Users/myUser/Projects/myProject/amplify/.temp/#current-cloud-backend/function/myFunction/lib/node_modules/.bin/loose-envify'

It seems that node_modules symlinks cause problems too. Is there a way to avoid that, and more important, how to bypass the probleme without deleting the entire stack? At first glance, i was really impressed by the promises of amplify but now i don't feel comfortable to use it in production. Reading issues opened, Amplify push does not seem to be really reliable for the moment..

mdebo avatar Dec 09 '19 22:12 mdebo

@mdebo Did you try deleting the /Users/myUser/Projects/myProject/amplify/.temp/ directory and running amplify push again?

kaustavghosh06 avatar Dec 10 '19 18:12 kaustavghosh06

Closing due to lack of requested information. Please feel free to comment on this issue if you're still stuck on this issue.

kaustavghosh06 avatar Dec 19 '19 22:12 kaustavghosh06

I have a similar issue:

1] I put a symlink inside the src directory of a Lambda function (created with the Amplify CLI). 2] I ran "amplify push" with no problems. 3] I removed the symlink. 4] I ran "amplify push" again:

✖ There was an error pulling the backend environment dev. An error occured during the push operation: ENOENT: no such file or directory, stat '/Users/grue/Projects/vol/backend/amplify/.temp/#current-cloud-backend/function/prepAsset/src/volLib'

5] I put the symlink back. 6] I ran "amplify push" again:

✖ There was an error pulling the backend environment dev. An error occured during the push operation: EEXIST: file already exists, symlink '../../../../../volLib' -> '/Users/grue/Projects/vol/backend/amplify/.temp/#current-cloud-backend/function/prepAsset/src/volLib'

(EDIT: Note that the errors are different.)

I've gone back and forth, removing and replacing the symlink. I've removed the amplify/.temp directory during many of these tests. I've even gone into the Lambda console and removed the volLib item from there. I always get one of the two errors above, no matter the combination of symlink, amplify/.temp, and the Lambda console.

It does occur to me that the actual function directory and the ./temp/#current-cloud-backend function directory are at different depths, so the ../ paths don't work in ./temp/#current-cloud-backend and may look like errors. That might be part of it. But I can't tell how to get out of this state.

EDIT: Even "amplify status" fails.

mrgrue avatar Jun 01 '20 17:06 mrgrue

Ok, I'm unblocked, and I didn't have to rebuild the entire project. Here's what I did:

1] I put an empty "volLib" directory in the amplify directory. That makes the symlinks from inside amplify/.temp resolve to something. 2] I deleted the function in the Lambda console. 3] I removed the symlinks from the amplify/.temp/#current-cloud-backend directory, AND the amplify/#current-cloud-backend directory. 4] I removed the amplify/.temp/#current-cloud-backend.zip 5] I ran 'amplify function remove' 6] I ran 'amplify push'.

So I think I'm working again.

Rule of thumb: DON'T USE SYMLINKS IN LAMBDA src/ DIRECTORIES.

Since symlinks are obviously not supported, my request for the amplify-cli team would be to add a check on "amplify push" to see if there are any symlinks in Lambda src directories, and bail out if there are.

mrgrue avatar Jun 01 '20 18:06 mrgrue

Running into similar issues. Deleting the Lambda manually got me in a worse state :scream:

I removed the erroring files from '#current-cloud-backend.zip' in s3://amplify-*-deployment bucket and delete all locally cached versions with git clean -ndx and rm amplify/.temp.

0xR avatar Jul 18 '20 10:07 0xR

I removed the erroring files from '#current-cloud-backend.zip' in s3://amplify-*-deployment bucket ...

That is the way to go .. download zip, fix and re-upload.

rubas avatar Jan 22 '21 21:01 rubas

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

github-actions[bot] avatar May 25 '21 07:05 github-actions[bot]