Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

dockerizePip: "git clone failed with error code 128 in None" error #230

@galindro

Description

@galindro

serverless-python-requirements version

4.1.1

Description

I'm trying to deploy my code using serverless-python-requirements, but this error is ocurring when I execute sls deploy. I've changed pip.js a little bit to print the docker options to stdout.

Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command requirements
Serverless: Load command requirements:clean
Serverless: Load command requirements:install
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Installing requirements of requirements.txt in .serverless...
Serverless: Docker Image: lambci/lambda:build-python3.6
[ 'run',
  '-v',
  '"/home/myuser/mycode:/var/task:z"',
  '-v',
  '/home/myuser/.ssh/id_rsa:/root/.ssh/id_rsa:z',
  '-v',
  '/home/myuser/.ssh/known_hosts:/root/.ssh/known_hosts:z',
  '-v',
  '/tmp/ssh-WhmLrY0zrGTs/agent.31137:/tmp/ssh_sock:z',
  '-e',
  'SSH_AUTH_SOCK=/tmp/ssh_sock',
  '-u',
  '1000',
  'lambci/lambda:build-python3.6',
  'python3.6',
  '-m',
  'pip',
  'install',
  '-t',
  '.serverless/requirements',
  '-r',
  '.serverless/requirements.txt' ]
 
  Error --------------------------------------------------
 
  The directory '/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Command "git clone -q ssh://git@bitbucket.org/my-repo/my_private_repo.git /tmp/pip-req-build-i1pzenek" failed with error code 128 in None

 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  Stack Trace --------------------------------------------
 
Error: The directory '/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Command "git clone -q ssh://git@bitbucket.org/my-repo/my_private_repo.git /tmp/pip-req-build-i1pzenek" failed with error code 128 in None

    at installRequirements (/home/myuser/mycode/node_modules/serverless-python-requirements/lib/pip.js:148:11)
    at targetFuncs.filter.map.f (/home/myuser/mycode/node_modules/serverless-python-requirements/lib/pip.js:225:11)
    at Array.map (native)
    at ServerlessPythonRequirements.installAllRequirements (/home/myuser/mycode/node_modules/serverless-python-requirements/lib/pip.js:220:8)
From previous event:
    at PluginManager.invoke (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:390:22)
    at PluginManager.spawn (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:408:17)
    at Deploy.BbPromise.bind.then.then (/usr/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:123:50)
From previous event:
    at Object.before:deploy:deploy [as hook] (/usr/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:113:10)
    at BbPromise.reduce (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:390:55)
From previous event:
    at PluginManager.invoke (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:390:22)
    at PluginManager.run (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:421:17)
    at variables.populateService.then.then (/usr/lib/node_modules/serverless/lib/Serverless.js:157:33)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
    at Serverless.run (/usr/lib/node_modules/serverless/lib/Serverless.js:144:8)
    at serverless.init.then (/usr/lib/node_modules/serverless/bin/serverless:43:50)
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           6.12.0
     Serverless Version:     1.29.2

If I remove the -u 1000 param from docker command line, the code is successfully built. But, another error is displayed when serverless tries to remove the .serverless/requirements/* content because the files inside it are created by root user from within container.

I've tried to run the docker command standalone, but the error persists. Also, more logs are displayed:

docker run -v "/home/myuser/mycode:/var/task:z" -v /home/myuser/.ssh/id_rsa:/root/.ssh/id_rsa:z -v /home/myuser/.ssh/known_hosts:/root/.ssh/known_hosts:z -v /tmp/ssh-WhmLrY0zrGTs/agent.31137:/tmp/ssh_sock:z -e SSH_AUTH_SOCK=/tmp/ssh_sock -u 1000 lambci/lambda:build-python3.6 python3.6 -m pip install -t .serverless/requirements -r .serverless/requirements.txt 
The directory '/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting git+ssh://git@bitbucket.org/my-repo/my_provate_repo.git@1.0.0 (from -r .serverless/requirements.txt (line 3))
  Cloning ssh://git@bitbucket.org/my-repo/my_provate_repo.git (to revision 1.0.0) to /tmp/pip-req-build-xkb3_7kq
No user exists for uid 1000
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Command "git clone -q ssh://git@bitbucket.org/my-repo/my_provate_repo.git /tmp/pip-req-build-xkb3_7kq" failed with error code 128 in None

How could I solve this???

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions