serverless-python-requirements
serverless-python-requirements copied to clipboard
requirements.txt file generated by "pip" or "echo file> **" is not being processed
Are you certain it's a bug?
- [X] Yes, it looks like a bug
Is the issue caused by a plugin?
- [X] It is not a plugin issue
Are you using the latest version?
- [X] Yes, I'm using the latest version
Is there an existing issue for this?
- [X] I have searched existing issues, it hasn't been reported yet
Issue description
Description
Requirements.txt file generated by pip is not being read during project build.
details:
HEX > pip freeze > requirements.txt
HEX >VScode Create file
HEX > echo "kafka-python==2.0.2" > sample.txt
My Solution
Use VsCode new file
Service configuration (serverless.yml) content
org: nithack
app: aws-node-project
service: teste-aws-file-requirements
frameworkVersion: '3'
provider:
name: aws
runtime: python3.8
functions:
hello:
handler: handler.hello
plugins:
- serverless-python-requirements
custom:
pythonRequirements:
dockerizePip: true
Command name and used flags
serverless deploy --verbose
Command output
Error:
Error: `docker run --rm -v C:/Users/Nithack/AppData/Local/UnitedIncome/serverless-python-requirements/Cache/41d011fa201321a2a981989b4352f98ec5776923ca6c6a0be89465cb5bb5591c_x86_64_slspyc:/var/task:z -v C:/Users/Nithack/AppData/Local/UnitedIncome/serverless-python-requirements/Cache/downloadCacheslspyc:/var/useDownloadCache:z -u 0 lambci/lambda:build-python3.8 python -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache` Exited with code 1
at ChildProcess.<anonymous> (C:\Projetos\onProjects\teste-aws-file-requirements\node_modules\child-process-ext\spawn.js:38:8)
at ChildProcess.emit (node:events:526:28)
at ChildProcess.emit (node:domain:475:12)
at ChildProcess.cp.emit (C:\Projetos\onProjects\teste-aws-file-requirements\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1092:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
Environment information
➜ serverless --version
Running "serverless" from node_modules
Framework Core: 3.16.0 (local) 3.15.1 (global)
Plugin: 6.2.2
SDK: 4.3.2
Hello @Nithack, based on the provided information it's hard to reproduce the issue. Do you have a chance to provide a small reproducible example that we could be run to replicate it?
@Nithack: are you using PowerShell? I think PS sometimes uses unicode (meaning UTF-16 (LE)) as default output encoding, making the file unreadable for pip
. Try pip freeze | Out-File -Encoding utf8 requirements.txt
instead. Mind that your serverless-python-requirements cache might still contain a corrupted version of the file, so clear the cache, disable it, or change your requirements.txt
to force a cache miss.