Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Serverless produce an Invalid Cross-device link Error when trying to package or deploy?

When running either command: sudo serverless package or sudo serverless deploy

I get the following traceback:

Error: ERROR: Exception: Traceback (most recent call last): File “/var/lang/lib/python3.6/shutil.py”, line 550, in move os.rename(src, real_dst) OSError: [Errno 18] Invalid cross-device link: ‘/tmp/pip-target-wqc5grcw/lib/python/setuptools’ -> ‘/var/task/setuptools’

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “/var/lang/lib/python3.6/site-packages/pip/_internal/cli/base_command.py”, line 228, in _main status = self.run(options, args) File “/var/lang/lib/python3.6/site-packages/pip/_internal/cli/req_command.py”, line 182, in wrapper return func(self, options, args) File “/var/lang/lib/python3.6/site-packages/pip/_internal/commands/install.py”, line 456, in run options.target_dir, target_temp_dir, options.upgrade File “/var/lang/lib/python3.6/site-packages/pip/_internal/commands/install.py”, line 514, in _handle_target_dir target_item_dir File “/var/lang/lib/python3.6/shutil.py”, line 561, in move symlinks=True) File “/var/lang/lib/python3.6/shutil.py”, line 321, in copytree os.makedirs(dst) File “/var/lang/lib/python3.6/os.py”, line 220, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: ‘/var/task/setuptools’

I’ve created several different projects and they work locally but they never progress beyond this invalid cross-link device Error when trying to deploy or package.

What are my options?

like image 546
larrywgray Avatar asked Sep 24 '20 14:09

larrywgray


People also ask

Why is it so hard to debug serverless apps on AWS?

While working on your Serverless app on AWS, you might notice that some of the errors can be really hard to debug. It can either be an obscure AWS error or it might just have a misleading error message. At Seed, we’ve had a chance to help a lot of our users work through some of these issues. We decided to catalogue the errors and their fixes.

What are the most common Serverless Framework errors?

Common Serverless Errors is a compilation of some of the most common Serverless Framework AWS errors and how to fix them. Available as an open source GitHub repo, edits and contributions are welcome! Service files not changed. Skipping deployment. No matching handler found. Check your service definition.

Why is the CloudFormation stack in an invalid state for preparation?

The CloudFormation stack is in an invalid state for preparation (DELETE_FAILED). The CloudFormation stack name is '<stack-name>--'. Please resolve the issue then attempt preparation again. This situation often arises when a deployed stack's subsequent deployment fails, along with the stack rollback or deletion.

What is the most common error in AWS CloudFormation?

The most common error I see our users encounter is when a deploy fails because a previous deploy was unsuccessful. I can relate to this one because I've encountered it myself many times! The state returned from AWS CloudFormation is usually UPDATE_ROLLBACK_FAILED or DELETE_FAILED, and the error will look something like this:


Video Answer


2 Answers

Edit: I tried nuking my virtualenv, uninstalling/re-installing serverless-python-requirements, deleting/re-pulling the lambci/lambda Docker image, no dice.

Then, I stumbled on this GH issue. As hinted in it, the experimental Docker feature Use gRPC FUSE for file sharing seems to be the cause. I've switched it off in the Docker Preferences for now and deploys are successful.

like image 53
logicalicy Avatar answered Oct 29 '22 00:10

logicalicy


I just had a similar problem. See this issue for a possible solution.

In summary,

  1. Remove all cached packages in /Library/Caches/serverless-python-requirements/
  2. Remove existing docker image lambci/lambda build-python3.8
like image 24
tmo Avatar answered Oct 28 '22 22:10

tmo