-
Notifications
You must be signed in to change notification settings - Fork 293
Invalid Mode /test when deploying using 4.2.5 #274
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
Comments
Same here! |
arg.. why does windows have to be so weird 😞 Any thoughts @rob-deans @kichik @PatrickBuTaxdoo |
Is that the complete log with If I had to guess, I would say the |
@kichik That is not the complete log but only where it failed. Everything else ran fine.
|
It should print all of the different Docker commands it's trying. It seems like the right Docker command is missing for you because they all fail. Either that, or the command is somehow malformed. It would be helpful if can check which variation is the closest to working and what's exactly missing in it. I assume, based on the error message, that something like the following should work:
Also, please include more details about your system. Docker for Windows or Docker Toolbox? Any other details could help. |
Same and debugged. After fixing it, next calling 'python.exe' on Docker container.
I fixed issues on my branch 'fix-issue-274', and it goes well using the serverless command on my pc. |
Same here. Serverless: Docker Image: lambci/lambda:build-python3.6 Error -------------------------------------------------- docker: Error response from daemon: invalid mode: /test. |
Seeing this as well. Here's a full log:
Docker: 18.06.1-ce-win73 Same result in GitBash and Cmd. |
Hi
The docker process exits with code 125 but if I removed the ", it works and docker process returns 0 as expected
I believe the problem lies in lib/pip.js at line 276
|
Thanks for digging in @naingyelin! What if the path has a space in it? IE rename |
@dschep I can confirm this command works for path with spaces, if you enclose the whole mount path in " including the :/test, just tested it :)
|
Ah. Thanks for that @naingyelin. That gives us a path forward! |
There is maybe some differences between command-line and spawnSync on Windows. testcode.js const { spawnSync } = require('child_process');
const options = ['arg1', '"arg2"', 'arg 3', '"arg 4"'];
// case1 like docker.js:13
spawnSync('reciever.bat', options, { });
// case2
spawnSync('reciever.bat', options, { windowsVerbatimArguments:true });
// case3 likes pip.js:249
spawnSync('reciever.bat', options, { shell:true }); reciever.bat echo ALL=%* >> result.txt
echo $1=%1 >> result.txt
echo $2=%2 >> result.txt
echo $3=%3 >> result.txt
echo $4=%4 >> result.txt
echo $5=%5 >> result.txt Result rem case1
ALL=arg1 "\"arg2\"" "arg 3" "\"arg 4\""
$1=arg1
$2="\"arg2\""
$3="arg 3"
$4="\"arg
$5=4\""
rem case2
ALL=arg1 "arg2" arg 3 "arg 4"
$1=arg1
$2="arg2"
$3=arg
$4=3
$5="arg 4"
rem case3
ALL=arg1 "arg2" arg 3 "arg 4"
$1=arg1
$2="arg2"
$3=arg
$4=3
$5="arg 4" Case1: double-quate in arg2 and arg4 are escaped and corrupted. But arg3 is escaped well. I tryed to fix this issue on my branch. but can not test on Mac. |
Awesome @T-Tmnr, could a window user test his change? Install it with |
@dschep I have just tested the build and it works, I am now able to deploy my flask app. Windows 10 Pro v1803 Build 17134.345 nvm v1.1.7 |
That's great news @naingyelin! @T-Tmnr, could you open a PR for your change? Also, could you make the change from |
FWIW, T-Tmnr's change worked for me as well. |
@dschep, I opened PR with modifying about dockerizePip. |
My information was "ONLY" bat file. I try to explore behavior with other command-line application. I make simple application "outarg.exe". #include <fstream>
#include <iostream>
#include <string>
int main(int argc, char* argv[])
{
std::ofstream ofs("result.txt", std::ofstream::app);
for (int i = 0; i < argc; i++) {
ofs << "argv[" << i << "]=" << argv[i] << "\n";
}
} And check spawnSync behavior. With options When default.
It does not corrupt! When windowsVerbatimArguments or shell option enabled.
Parameters are corrupted. With options When default.
It does not corrupt! When windowsVerbatimArguments or shell option enabled.
It does not corrupt and does not have double-quate! With options When default.
This case is not in current code. When windowsVerbatimArguments or shell option enabled.
It does not corrupt and does not have double-quate too! In docker.js, calling spawnSync with default option. My solution on fix-issue-274, Another solution on fix-issue-274-another, Both solutions fix this issue. |
Thanks for the thorough report @T-Tmnr! |
Nevermind. I realize now that you were referring to the plugin version itself. |
This issue is still not fixed for me on Windows 10. Like the others above, I have to downgrade to 4.2.4 on every single serverless project that I create. |
@derekhuizhang Since the changes were merged no newer version was released. So the only solution atm is to downgrade. |
After running
sls deploy
invalid mode error appears when using 4.2.5, works fine on 4.2.4.I think it might be due to #187 adding quotes to the bindpath.
Environment Info
The text was updated successfully, but these errors were encountered: