Serverless-python-requirements: WSL Unknown path format

Created on 13 Jun 2019  路  5Comments  路  Source: UnitedIncome/serverless-python-requirements

On WSL Ubuntu 18.04LTS I'm getting

Unknown path format

when I use dockerizePip=true

in node_modules/serverless-python-requirements/lib/docker.js, getBindPath is being called with servicePath=="/home/davidg/lambda-serverless-test/.serverless/requirements"

That function seems to require the servicePath point to somewhere on my windows filesystem (/mnt/c/...) Is there no support for projects located in my wsl home directory?

FWIW I followed the README instructions regarding running under WSL and did step 1 and 2.

Windows bug

Most helpful comment

I had the same issue.
After debugging a bit in node_modules/serverless-python-requirements/lib/docker.js I found that the correct path was being passed into the getBindPath function.
However there is an if statement at the top

// Determine bind path
  if (process.platform !== 'win32' && !isWsl) {
    return servicePath;
  }

For me

  • process.platform = linux
  • isWsl = true

So it does NOT immediately return servicePath; but continues on to some code that falls over.
To get it to work for me locally I put return servicePath; at the top of the function and it worked.

I am guessing this was added for the original WSL on windows and hasn't been updated for WSL2.

All 5 comments

I upgraded to WSL2 on the insider preview and get the same issue when running inside of a point not in /c/ (changed mount path). Flipping the !isWsl check in the bellow code (line 103-107)
function getBindPath(serverless, servicePath) { // Determine bind path if (process.platform !== 'win32' && isWsl) { return servicePath; }
Will allow the plugin to skip the getBindPath function from inside WSL, but it should be totally valid to run the serverless plugin completely inside of the WSL filesystem (even more so since in WSL2 there is a significant slowdown when accessing windows files as the linux is now its own filesystem now).

If I'm running inside WSL, but running my python code from inside the linux side of the filesystem and not the /c/ or /mnt/c/ mount the code checks that I have to have one of the following formats:
/'drive_letter'/
/mnt/c/
c:/
but will then fail as I don't throwing the error. If you bypass this entire function when it doesn't find a path format though it will succeed and run.

Having this same issue as well.

This became an issue starting in 5.x, 4.3.0 works well.

any solutions ?

Using WSL2 with Docker-Desktop

  Error: Unknown path format owleaf/.cache/serverless-python-requirements/2eebda49882e665cca2bf1e3a571b1c2f6ec0d2bac04ecf76484eb7dce7fd498_slspyc...
      at getBindPath (/mnt/d/Courses/TSAI-DeepVision-EVA4.0-Phase-2/01-Deploy-To-AWS/sls-flask-ml-test/node_modules/serverless-python-requirements/lib/docker.js:132:11)

txt Your Environment Information --------------------------- Operating System: linux Node Version: 14.5.0 Framework Version: 1.74.1 Plugin Version: 3.6.15 SDK Version: 2.3.1 Components Version: 2.31.12

I had the same issue.
After debugging a bit in node_modules/serverless-python-requirements/lib/docker.js I found that the correct path was being passed into the getBindPath function.
However there is an if statement at the top

// Determine bind path
  if (process.platform !== 'win32' && !isWsl) {
    return servicePath;
  }

For me

  • process.platform = linux
  • isWsl = true

So it does NOT immediately return servicePath; but continues on to some code that falls over.
To get it to work for me locally I put return servicePath; at the top of the function and it worked.

I am guessing this was added for the original WSL on windows and hasn't been updated for WSL2.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IanTayler picture IanTayler  路  4Comments

miketheman picture miketheman  路  3Comments

chinalikai picture chinalikai  路  5Comments

xedef picture xedef  路  3Comments

jnicho02 picture jnicho02  路  6Comments