Skip to content

"process.getuid is not a function" on Windows #21

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
ChrisAnn opened this issue Apr 19, 2017 · 13 comments · Fixed by #64
Closed

"process.getuid is not a function" on Windows #21

ChrisAnn opened this issue Apr 19, 2017 · 13 comments · Fixed by #64
Assignees

Comments

@ChrisAnn
Copy link

ChrisAnn commented Apr 19, 2017

process.getuid is not a function error when running on Windows. This seems to be a POSIX only function.

Are you able to conditionally exclude it?

@ChrisAnn ChrisAnn changed the title process.getuid is not a function on Windows "process.getuid is not a function" on Windows Apr 19, 2017
@dschep
Copy link
Contributor

dschep commented Apr 19, 2017

Does -u on docker similarly not exist then? Or rather, how does windows + docker deal with user issues?

@ChrisAnn
Copy link
Author

I haven't yet played with docker. I'll ask around.

@ChrisAnn
Copy link
Author

Come to think of it, could you create the docker command only when the project specifies it'll be dockerizing the packages? As I'm not using docker, this will become a non-issue for me.

@dschep
Copy link
Contributor

dschep commented Apr 19, 2017

Good call. I didn't realize I was creating the command for docker even if it isn't being used. Should be an easy fix, I'll do it when I get the chance.

@dschep
Copy link
Contributor

dschep commented Apr 20, 2017

@ChrisAnn, you should be able to use v2.1.2 that I just pushed. I'll leave this issue open tho to track the fact that the dockerize option doesn't work on windows.

@felschr
Copy link

felschr commented Jun 30, 2017

I tried 2.1.2 and 2.3.3 and I get the error on Windows.

@dschep
Copy link
Contributor

dschep commented Jun 30, 2017

@felschr are you trying to use docker? If so, do you know the answer to my above question about a -u flag?

@felschr
Copy link

felschr commented Jul 1, 2017

@dschep Yes, I was. I'll check it next week.

@felschr
Copy link

felschr commented Jul 3, 2017

The help for docker run lists:

  -u, --user string                    Username or UID (format:
                                       <name|uid>[:<group|gid>])
      --userns string                  User namespace to use
      --uts string                     UTS namespace to use

I ran the following command in the CMD to see what happens:
docker run -u process.getuid() lambci/lambda:build-python2.7
And I got the following error:

At line:1 char:30
+ docker run -u process.getgid()
+                              ~
An expression was expected after '('.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : ExpectedExpression

Now when I put process.getuid() in quotes like this:
docker run -u "process.getuid()" lambci/lambda:build-python2.7
it seems to work fine:

Unable to find image 'lambci/lambda:build-python2.7' locally
build-python2.7: Pulling from lambci/lambda
d70ace93110d: Pull complete
30488ed80050: Pull complete
a1689653829f: Pull complete
Digest: sha256:9bd1b82b73a2317c1ce491f80aaa28443ab6b05381434193f33c99eb0df700b5
Status: Downloaded newer image for lambci/lambda:build-python2.7
docker: Error response from daemon: No command specified.
See 'docker run --help'.

Maybe that's the problem? I have no clue where process.getuid() comes from.
I hope this helps you a bit.

@felschr
Copy link

felschr commented Jul 3, 2017

Oh, I stumbled upon the node.js documentation for process.getuid() and it actually states that it's only available on POSIX platforms;
https://nodejs.org/api/process.html#process_process_getuid

@dschep
Copy link
Contributor

dschep commented Jul 3, 2017

Cool Thanks. Yeah i knew the nodeJs side of the story, was unsure of the docker side. That looks like maybe on window It could fall back to process.env.USERNAME. Could you try the branch I just pushed relating to this? npm install unitedincome/serverless-python-requirements#docker-windows

@felschr
Copy link

felschr commented Jul 3, 2017

@dschep I tried it and this is the result:

  docker: Error response from daemon: linux spec user: unable to find user felix_schroeter: no matching entries in passwd file.


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

@dschep
Copy link
Contributor

dschep commented Jul 3, 2017

Ah, that makes sense that the user wouldn't exist in the linux VM that docker for windows creates. I guess i'll just completely skip the -u option on windows, barring a better option. I'll whip that up when I have some downtime again.

@dschep dschep self-assigned this Aug 1, 2017
dschep added a commit that referenced this issue Aug 23, 2017
dschep added a commit that referenced this issue Aug 23, 2017
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

Successfully merging a pull request may close this issue.

3 participants