Skip to content

v4.2.0 breaks deployment in path containing spaces #242

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

Closed
notEvil opened this issue Sep 14, 2018 · 11 comments
Closed

v4.2.0 breaks deployment in path containing spaces #242

notEvil opened this issue Sep 14, 2018 · 11 comments

Comments

@notEvil
Copy link

notEvil commented Sep 14, 2018

Hope its reproducible. The error message says

Invalid requirement: {part after space}
It looks like a path. File {part after space} does not exist.

v4.1.1 works just fine

@AndrewFarley
Copy link
Contributor

AndrewFarley commented Sep 14, 2018

I'll look into this now... @notEvil can you provide your current file path, OS, serverless.yml and requirements.txt for me incase I need it for further debugging. I did test this already but it must be combination of your setup, config, OS, something. Please give more info now and in the future when you log bugs. Thanks!

@notEvil
Copy link
Author

notEvil commented Sep 14, 2018

I can reproduce with minimal setup

path: $HOME/directorywith space/
OS: Linux Mint 18.3

serverless.yml:

service: tspace

provider:
    name: aws

functions:
    space:
        handler: handler.handle

plugins:
  - serverless-python-requirements

requirements.txt:

-i https://pypi.org/simple
boto3

yes it could be setup specific, but as everything works when fixing version to 4.1.1, I thought its not necessary

@AndrewFarley
Copy link
Contributor

AndrewFarley commented Sep 14, 2018

@notEvil Give me a few minutes to finish some other work and I'll do some digging, I couldn't replicate it on my machines, but thanks... right off the bat I can tell you your requirements looks suspicious because it doesn't actually have any (usable) contents in it. Boto3 is skipped since it's auto-included on AWS Lambda. If you want to save me some effort, can you try putting something besides boto3 in there? Eg: pyyaml? And tell me if that works? However of course it shouldn't fail so fatally as it does. Thanks, and I'll get back to you shortly.

@notEvil
Copy link
Author

notEvil commented Sep 14, 2018

I just looked at the differences between 4.1.1 and 4.2.0 and have a hunch. Maybe it has something to do with quote which was introduced between the versions and itself introduces single or double quotes.

Adding pyyaml had no effect

I will try to log debug this too when I have time

@dschep
Copy link
Contributor

dschep commented Sep 14, 2018

Interesting. I've added a test that proves this: 837f063

@AndrewFarley
Copy link
Contributor

Yeah, I found the bug also, I'm fixing it now. :) Thanks for the test!

@AndrewFarley
Copy link
Contributor

AndrewFarley commented Sep 14, 2018

@notEvil Can you please try the following merge request (#244) see if this fixes your problem, from within your project... I confirm this fixes all tests, all options, etc, on Ubuntu and Mac when there's a space in the path. Thanks for the bug report, and sorry about this!

rm -Rf node_modules/serverless-python-requirements
npm i github:andrewfarley/serverless-python-requirements#bug-space-paths
sls package

@Nihilight
Copy link

Nihilight commented Sep 16, 2018

Hey @AndrewFarley
I encounter the same error ("looks like a path"), but for relative paths. Even with your fix branch bug-space-paths.
This works in v4.1.1

requirements.txt

../../../../interfaces/python/

Here's the serverless log:

Serverless: Generated requirements from CWD/requirements.txt...
Serverless: Installing requirements from CWD/.serverless/requirements/requirements.txt ...
Invalid requirement: '../../../../interfaces/python/'
It looks like a path. Does it exist ?

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

  null

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

  Stack Trace --------------------------------------------

Error: null
    at installRequirements (CWD/node_modules/serverless-python-requirements/lib/pip.js:259:11)
    at installRequirementsIfNeeded (CWD/node_modules/serverless-python-requirements/lib/pip.js:437:3)
    at targetFuncs.filter.map.f (CWD/node_modules/serverless-python-requirements/lib/pip.js:480:35)
    at Array.map (<anonymous>)
    at ServerlessPythonRequirements.installAllRequirements (CWD/aws/node_modules/serverless-python-requirements/lib/pip.js:474:8)

EDIT:
The issue is the change to the cwd argument for spawnSync
In v4.1.1 it was my CWD
In the new version it is CWD/.serverless/requirements

@AndrewFarley
Copy link
Contributor

@Nihilight Ah yeah, I can't win... that's a different issue, but related to this fix. Ugh... :P Can you get me more details on your setup? as much as you can from your serverless.yml, requirements.txt, your cwd, your OS, etc. Maybe open a new bug for me with those details and I'll see if I can replicate and fix it for you.

@Nihilight
Copy link

Done. #245

@notEvil
Copy link
Author

notEvil commented Sep 17, 2018

@AndrewFarley it works, thanks a lot

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

4 participants