Skip to content

dockerizePip in Windows does not resolve HOME directory #617

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

Open
dhrimov opened this issue Jun 24, 2021 · 1 comment
Open

dockerizePip in Windows does not resolve HOME directory #617

dhrimov opened this issue Jun 24, 2021 · 1 comment

Comments

@dhrimov
Copy link

dhrimov commented Jun 24, 2021

When using dockerized requirements, the docker run command is not correct. Older version (1.83.2) had the correct path like:

Serverless: Running docker run --rm -v C\:/Project/dhrimov/dhrimov-blog-lambdas/.serverless/test1/requirements\:/var/task\:z -v C:\\Users\\dmytr/.ssh/id_rsa\:/root/.ssh/id_rsa\:z -v C:\\Users\\dmytr/.ssh/known_hosts\:/root/.ssh/know
n_hosts\:z -v undefined\:/tmp/ssh_sock\:z -e SSH_AUTH_SOCK\=/tmp/ssh_sock -u 0 lambci/lambda\:build-python3.6 python -m pip install -t /var/task/ -r /var/task/requirements.txt...
serverless.yml
service: dhrimov-blog-lambdas

frameworkVersion: ">=2.48.0 <3.0.0"

resources:
  Description: Lambdas that handle all blog interactions

provider:
  stackName: ${opt:stage, self:provider.stage}-${self:service}
  stackTags:
    tier: ${opt:stage, self:provider.stage}
    managedBy: serverless
  name: aws
  runtime: python3.6
  region: eu-central-1
  stage: dev
  deploymentBucket:
    name: ***

plugins:
  - serverless-plugin-git-variables
  - serverless-apigw-binary
  - serverless-offline
  - serverless-prune-plugin
  - serverless-python-requirements

package:
  individually: true
  excludeDevDependencies: false
  exclude:
    - .tox/**
    - env/**
    - node_modules/**

    - "**/.coverage"
    - "**/__pycache__/**"
    - "**/env/**"
    - "**/tests/**"

functions:

  dhrimov-blog-test1:
    handler: main.handler
    module: test1
    name: ${opt:stage, self:provider.stage}-dhrimov-blog-test1
    memorySize: 128
    timeout: 10
    description: ${self:service}
    events:
      - http:
          path: test1
          method: get
          cors: true

custom:
  prune:
    automatic: true
    number: 5

  apigwBinary:
    types:
      - "*/*"

  pythonRequirements:
    zip: true
    dockerizePip: true
    dockerSsh: true
    useDownloadCache: false
    useStaticCache: false
    invalidateCaches: true
sls deploy --stage dev output
Serverless: Adding Python requirements helper to test1...
Serverless: Adding Python requirements helper to test2...
Serverless: Generated requirements from C:\Project\dhrimov\dhrimov-blog-lambdas\test1\requirements.txt in C:\Project\dhrimov\dhrimov-blog-lambdas\.serverless\test1\requirements.txt...
Serverless: Installing requirements from C:\Project\dhrimov\dhrimov-blog-lambdas\.serverless\test1\requirements\requirements.txt ...
Serverless: Docker Image: lambci/lambda:build-python3.6
Serverless: Running docker run --rm -v C\:/Project/dhrimov/dhrimov-blog-lambdas/.serverless/test1/requirements\:/var/task\:z -v **undefined/.ssh/id_rsa**\:/root/.ssh/id_rsa\:z -v undefined/.ssh/known_hosts\:/root/.ssh/known_hosts\:z -v
undefined\:/tmp/ssh_sock\:z -e SSH_AUTH_SOCK\=/tmp/ssh_sock -u 0 lambci/lambda\:build-python3.6 python -m pip install -t /var/task/ -r /var/task/requirements.txt...

 Error ---------------------------------------------------

  Error: STDOUT:

  STDERR: docker: Error response from daemon: create undefined/.ssh/id_rsa: "undefined/.ssh/id_rsa" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host di
rectory, use absolute path.
  See 'docker run --help'.

      at C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\serverless-python-requirements\lib\pip.js:331:13
      at Array.forEach (<anonymous>)
      at installRequirements (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\serverless-python-requirements\lib\pip.js:318:28)
      at installRequirementsIfNeeded (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\serverless-python-requirements\lib\pip.js:576:3)
      at C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\serverless-python-requirements\lib\pip.js:619:35
      at Array.map (<anonymous>)
      at ServerlessPythonRequirements.installAllRequirements (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\serverless-python-requirements\lib\pip.js:613:8)
      at ServerlessPythonRequirements.tryCatcher (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\bluebird\js\release\util.js:16:23)
      at Promise._settlePromiseFromHandler (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\bluebird\js\release\promise.js:547:31)
      at Promise._settlePromise (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\bluebird\js\release\promise.js:604:18)
      at Promise._settlePromise0 (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\bluebird\js\release\promise.js:649:10)
      at Promise._settlePromises (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\bluebird\js\release\promise.js:729:18)
      at Promise._fulfill (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\bluebird\js\release\promise.js:673:18)
      at MappingPromiseArray.PromiseArray._resolve (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\bluebird\js\release\promise_array.js:127:19)
      at MappingPromiseArray._promiseFulfilled (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\bluebird\js\release\map.js:108:18)
      at Promise._settlePromise (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\bluebird\js\release\promise.js:609:26)
      at Promise._settlePromise0 (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\bluebird\js\release\promise.js:649:10)
      at Promise._settlePromises (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\bluebird\js\release\promise.js:729:18)
      at Promise._fulfill (C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\bluebird\js\release\promise.js:673:18)
      at C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\bluebird\js\release\nodeback.js:42:21
      at C:\Project\dhrimov\dhrimov-blog-lambdas\node_modules\graceful-fs\polyfills.js:247:20
      at FSReqCallback.oncomplete (fs.js:154:23)

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          win32
     Node Version:              12.16.1
     Framework Version:         2.48.0 (local)
     Plugin Version:            5.4.2
     SDK Version:               4.2.3
     Components Version:        3.12.0

Installed version

Framework Core: 2.48.0 (local)
Plugin: 5.4.2
SDK: 4.2.3
Components: 3.12.0
@tharun634
Copy link

what fixed this for me was setting a env variable in my powershell by running
$env:HOME=C:/Users/<user-name>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants