This repository was archived by the owner on Oct 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 294
This repository was archived by the owner on Oct 24, 2025. It is now read-only.
Deploy fails: ValueError: embedded null byte #226
Copy link
Copy link
Closed
Description
When I try to deploy I get an "embedded null byte" error. It appears null bytes are inserted when the serverless-python-requirements plugin copies the requirements.txt file to the .serverless directory.
PS> serverless deploy
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
Serverless: Trying bindPath C:/Users/me/projects/playground/sls/with_rds (run,--rm,-v,C:/Users/me/Dropbox/projects/playground/sls/with_rds:/test,alpine,ls,/test/serverless.yml)
Serverless: /test/serverless.yml
Error --------------------------------------------------
Exception:
Traceback (most recent call last):
File "/var/lang/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 228, in main
status = self.run(options, args)
File "/var/lang/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 267, in run
self.name, wheel_cache
File "/var/lang/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 314, in populate_requirement_set
wheel_cache=wheel_cache):
File "/var/lang/lib/python3.6/site-packages/pip/_internal/req/req_file.py", line 89, in parse_requirements
for req in req_iter:
File "/var/lang/lib/python3.6/site-packages/pip/_internal/req/req_file.py", line 156, in process_line
isolated=isolated, options=req_options, wheel_cache=wheel_cache
File "/var/lang/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 206, in from_line
looks_like_dir = os.path.isdir(p) and (
File "/var/lang/lib/python3.6/genericpath.py", line 42, in isdir
st = os.stat(s)
ValueError: embedded null byte
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
Error: Exception:
Traceback (most recent call last):
File "/var/lang/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 228, in main
status = self.run(options, args)
File "/var/lang/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 267, in run
self.name, wheel_cache
File "/var/lang/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 314, in populate_requirement_set
wheel_cache=wheel_cache):
File "/var/lang/lib/python3.6/site-packages/pip/_internal/req/req_file.py", line 89, in parse_requirements
for req in req_iter:
File "/var/lang/lib/python3.6/site-packages/pip/_internal/req/req_file.py", line 156, in process_line
isolated=isolated, options=req_options, wheel_cache=wheel_cache
File "/var/lang/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 206, in from_line
looks_like_dir = os.path.isdir(p) and (
File "/var/lang/lib/python3.6/genericpath.py", line 42, in isdir
st = os.stat(s)
ValueError: embedded null byte
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
at installRequirements (C:\Users\me\Dropbox\projects\playground\sls\with_rds\node_modules\serverless-python-requirements\lib\pip.js:146:11)
at ServerlessPythonRequirements.installAllRequirements (C:\Users\me\Dropbox\projects\playground\sls\with_rds\node_modules\serverless-python-requirements\lib\pip.js:242:5)
From previous event:
at PluginManager.invoke (C:\Users\me\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:390:22)
at PluginManager.spawn (C:\Users\me\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:408:17)
at Deploy.BbPromise.bind.then.then (C:\Users\me\AppData\Roaming\npm\node_modules\serverless\lib\plugins\deploy\deploy.js:123:50)
From previous event:
at Object.before:deploy:deploy [as hook] (C:\Users\me\AppData\Roaming\npm\node_modules\serverless\lib\plugins\deploy\deploy.js:113:10)
at BbPromise.reduce (C:\Users\me\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:390:55)From previous event:
at PluginManager.invoke (C:\Users\me\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:390:22)
at PluginManager.run (C:\Users\me\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:421:17)
at variables.populateService.then.then (C:\Users\me\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:157:33)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
at Serverless.run (C:\Users\me\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:144:8)
at serverless.init.then (C:\Users\me\AppData\Roaming\npm\node_modules\serverless\bin\serverless:43:50)
at <anonymous>
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information -----------------------------
OS: win32
Node Version: 8.11.3
Serverless Version: 1.29.2
I'm running the latest version of the serverless-python-requirements plugin.
Docker version 18.06.0-ce, build 0ffa825
Contents of ./.serverless/requirements.txt

Contents of ./requirements.txt
asn1crypto==0.24.0
cffi==1.11.5
cryptography==2.3
idna==2.7
pycparser==2.18
PyMySQL==0.9.2
six==1.11.0
I get the same error on my macos box too. The function works when invoked locally.
I'd appreciate help getting to the bottom of this.
Metadata
Metadata
Assignees
Labels
No labels