aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.81k stars 819 forks source link

Amplify push, pull and publish error: EEXIST: file already exists, symlink #5423

Closed cDask closed 3 years ago

cDask commented 4 years ago

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

Describe the bug Getting the following bug when running amplify pull, push and publish


EEXIST: file already exists, symlink 'lib' -> '/home/ubuntu/environment/music/amplify/.temp/#current-cloud-backend/function/Countries/lib64'
Error: EEXIST: file already exists, symlink 'lib' -> '/home/ubuntu/environment/music/amplify/.temp/#current-cloud-backend/function/Countries/lib64'

Have tried to delete the function in question using amplify remove function which seems to have succeeded as it is no longer listed when running amplify remove function again. As well as it not being listed when running amplify status.

Have also tried deleting the .temp folder and running amplify pull again which gave me a new error:

ENOENT: no such file or directory, stat '/home/ubuntu/environment/music/amplify/.temp/#current-cloud-backend/function/Countries/bin/python'
Error: ENOENT: no such file or directory, stat '/home/ubuntu/environment/music/amplify/.temp/#current-cloud-backend/function/Countries/bin/python'
    at Object.statSync (fs.js:855:3)
    at Object.statSync (/home/ubuntu/.nvm/versions/node/v10.22.0/lib/node_modules/@aws-amplify/cli/node_modules/graceful-fs/polyfills.js:307:34)
    at getStatsSync (/home/ubuntu/.nvm/versions/node/v10.22.0/lib/node_modules/@aws-amplify/cli/node_modules/fs-extra/lib/util/stat.js:58:18)
    at Object.checkPathsSync (/home/ubuntu/.nvm/versions/node/v10.22.0/lib/node_modules/@aws-amplify/cli/node_modules/fs-extra/lib/util/stat.js:90:33)
    at copyDirItem (/home/ubuntu/.nvm/versions/node/v10.22.0/lib/node_modules/@aws-amplify/cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:119:29)
    at fs.readdirSync.forEach.item (/home/ubuntu/.nvm/versions/node/v10.22.0/lib/node_modules/@aws-amplify/cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:113:39)
    at Array.forEach (<anonymous>)
    at copyDir (/home/ubuntu/.nvm/versions/node/v10.22.0/lib/node_modules/@aws-amplify/cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:113:23)
    at mkDirAndCopy (/home/ubuntu/.nvm/versions/node/v10.22.0/lib/node_modules/@aws-amplify/cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:108:3)
    at onDir (/home/ubuntu/.nvm/versions/node/v10.22.0/lib/node_modules/@aws-amplify/cli/node_modules/fs-extra/lib/copy-sync/copy-sync.js:99:25)

Then running amplify status after this gives me:

ENOENT: no such file or directory, stat '/home/ubuntu/environment/music/amplify/#current-cloud-backend/hosting/amplifyhosting'
Error: ENOENT: no such file or directory, stat '/home/ubuntu/environment/music/amplify/#current-cloud-backend/hosting/amplifyhosting'

Which Im only able to fix by deleting everything in the #current-cloud-backend folder and copying these folders from my backend folder which was suggested to me by AWS support.

Amplify CLI Version 4.29.3

Terminal Error

✖ There was an error pulling the backend environment backend.
An error occurred during the push operation: EEXIST: file already exists, symlink 'lib' -> '/home/ubuntu/environment/music/amplify/.temp/#current-cloud-backend/function/Countries/lib64'

Expected behavior The amplify pull,push and publish to go through.

Desktop (please complete the following information):

swyxio commented 4 years ago
ran into another user with this same issue on @dabit3's workshop today I get error as..: cala-am02048458:postagram kaori$ amplify push ⠋ Fetching updates to backend environment: dev from the cloud.(node:44361) ExperimentalWarning: The fs.promises API is experimental ✖ There was an error pulling the backend environment dev. An error occurred during the push operation: EEXIST: file already exists, mkdir '/Users/kaori/Documents/Training/AWS/Workshop/amplify-photo-sharing/postagram/amplify/.temp/#current-cloud-backend' cala-am02048458:postagram kaori$ 04:08 Shawn 04:08 hmmm xzvvjjw4bgs5:b97405ba15f6039dc93a72448e01665b3b74ed16 I tried delete '/Users/kaori/Documents/Training/AWS/Workshop/amplify-photo-sharing/postagram/amplify/.temp/#current-cloud-backend' but the still get the same error 04:09 Shawn 04:11 it sounds like something was corrupted 04:11 i might try deleting the entire /amplify folder and then running `amplify pull` 04:12 to clear away any bad files xzvvjjw4bgs5:b97405ba15f6039dc93a72448e01665b3b74ed16 cala-am02048458:postagram kaori$ pwd /Users/kaori/Documents/Training/AWS/Workshop/amplify-photo-sharing/postagram 04:19 I deleted amplify folder :( 04:19 Shawn 04:20 cool, then start over on the instructions xzvvjjw4bgs5:b97405ba15f6039dc93a72448e01665b3b74ed16 I mean, amplify pull gives me the same error after I deleted the folder 04:20 cala-am02048458:postagram kaori$ amplify pull For more information on AWS Profiles, see: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html ? Do you want to use an AWS profile? (Y/n) (node:48485) ExperimentalWarning: The fs.promises API is experimental ? Do you want to use an AWS profile? Yes ? Please choose the profile you want to use amplify-cli-user ? Which app are you working on? d1vrqcnm908b52 Backend environment 'dev' found. Initializing... Failed to pull the backend. EEXIST: file already exists, mkdir '/Users/kaori/Documents/Training/AWS/Workshop/amplify-photo-sharing/postagram/amplify/.temp/#current-cloud-backend' Error: EEXIST: file already exists, mkdir '/Users/kaori/Documents/Training/AWS/Workshop/amplify-photo-sharing/postagram/amplify/.temp/#current-cloud-backend' 04:20 cala-am02048458:postagram kaori$ amplify pull For more information on AWS Profiles, see: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html ? Do you want to use an AWS profile? (Y/n) (node:48485) ExperimentalWarning: The fs.promises API is experimental ? Do you want to use an AWS profile? Yes ? Please choose the profile you want to use amplify-cli-user ? Which app are you working on? d1vrqcnm908b52 Backend environment 'dev' found. Initializing... Failed to pull the backend. EEXIST: file already exists, mkdir '/Users/kaori/Documents/Training/AWS/Workshop/amplify-photo-sharing/postagram/amplify/.temp/#current-cloud-backend' Error: EEXIST: file already exists, mkdir '/Users/kaori/Documents/Training/AWS/Workshop/amplify-photo-sharing/postagram/amplify/.temp/#current-cloud-backend' 04:21 Shawn 04:29 hmm so did you manage to delete the folder or not? i dont understand why it would say the file already exists xzvvjjw4bgs5:b97405ba15f6039dc93a72448e01665b3b74ed16 That's my question. 04:33 I pasted my ll command and you see the folder is not there 04:34 but still complaining about the non-existing file 04:34 Shawn 04:34 bizarre 04:34 (i havent run into this at all 04:34 let me take a quick look to see if there are similar github issues xzvvjjw4bgs5:b97405ba15f6039dc93a72448e01665b3b74ed16 both pull and push get has the same issue. I started over from "amplify init" but got stuck in the same point. 04:35 Shawn 04:35 hmm this looks VERY similar https://github.com/aws-amplify/amplify-cli/issues/5423 04:35 i think theres something to do with symlinking
GregorioMarquez commented 4 years ago

I ran with the same issue today just by following the instructions on the tutorial. My setup: macOS Mojave 10.14.6 node --version v10.6.0 npm --version 6.1.0 git --version 2.20.1 (Apple Git-117)

amplify push ⠋ Fetching updates to backend environment: dev from the cloud.(node:4925) ExperimentalWarning: The fs.promises API is experimental ✖ There was an error pulling the backend environment dev. An error occurred during the push operation: EEXIST: file already exists, mkdir '/Users/gregoriomarquez/dagtus/oasis/aws/amplify/vue/projects/gettingStartedApp/myamplifyproject/amplify/.temp/#current-cloud-backend'

I tried the fix mentioned by @cDask but have'nt had success.

zpodolyak commented 4 years ago

I had an existing project using older Amplify libraries. Everything was building and working correctly. Then, I updated my PodFile to new libraries (1.0.0), built my code, but then I was no longer able to issue an amplify pull or amplify push thereafter. Furthermore, amplify status now claims that all of my resources are in the Create state, even though I haven't changed any of them. I did, however, run an amplify init after updating my pods. I don't know how to get my project back to a working state.

Error: EEXIST: file already exists, mkdir '/Users/zpodolyak/Projects/<myapp>/amplify/.temp/#current-cloud-backend'

blazinaj commented 4 years ago

I've been having this issue for a long time and can't find a fix. I cannot checkout any amplify environment.

$ amplify env checkout sandbox
✖ There was an error initializing your environment.
EEXIST: file already exists, symlink '..\acorn\bin\acorn' -> '/home/ec2-user/environment/application-root/amplify/.temp/#current-cloud-backend/function/graphqlfunctions/lib/nodejs/node_modules/.bin/acorn'

This happened when I switched from my Windows desktop to AWS Cloud9

UnleashedMind commented 4 years ago

This is a duplicate of https://github.com/aws-amplify/amplify-cli/issues/2948 Currently the CLI can not handle symlinks in Lambda functions due to the zip and unzip operations of the #current-cloud-backend folder. please reference the comment on how to unblock your project.

@GregorioMarquez @zpodolyak Did you guys have symlinks in your project? if not, then they are different issues, you can remove the .temp folder and that should unblock you, if you are still blocked, please open another github issue so we can address them separately.

edwardfoyle commented 3 years ago

closing as issue seems to be caused by symlinks in the lambda zip folder. Please open a new issue if you believe there is something else at play.

github-actions[bot] commented 2 years ago

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.