question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error 500 after authentication

See original GitHub issue

Hi, I configured the LDAP auth and that seems to be ok but after login I’ve got a crash:

[I 2018-04-04 08:02:58.321 JupyterHub log:122] 200 GET /hub/login (@172.29.0.1) 27.27ms
[I 2018-04-04 08:03:08.584 JupyterHub base:346] User logged in: pafer
[E 2018-04-04 08:03:08.642 JupyterHub user:427] Unhandled error starting pafer's server: 'getpwnam(): name not found: pafer'
[E 2018-04-04 08:03:08.664 JupyterHub web:1621] Uncaught exception POST /hub/login?next= (172.29.0.1)
    HTTPServerRequest(protocol='http', host='172.29.0.2:8000', method='POST', uri='/hub/login?next=', version='HTTP/1.1', remote_ip='172.29.0.1')
    Traceback (most recent call last):
      File "/opt/workdir/.venv/lib64/python3.6/site-packages/tornado/web.py", line 1543, in _execute
        result = yield result
      File "/opt/workdir/.venv/lib64/python3.6/site-packages/jupyterhub/handlers/login.py", line 94, in post
        yield self.spawn_single_user(user)
      File "/opt/workdir/.venv/lib64/python3.6/site-packages/jupyterhub/handlers/base.py", line 475, in spawn_single_user
        yield gen.with_timeout(timedelta(seconds=self.slow_spawn_timeout), finish_spawn_future)
      File "/opt/workdir/.venv/lib64/python3.6/site-packages/jupyterhub/handlers/base.py", line 445, in finish_user_spawn
        yield spawn_future
      File "/opt/workdir/.venv/lib64/python3.6/site-packages/jupyterhub/user.py", line 439, in spawn
        raise e
      File "/opt/workdir/.venv/lib64/python3.6/site-packages/jupyterhub/user.py", line 378, in spawn
        ip_port = yield gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
      File "/usr/lib64/python3.6/types.py", line 248, in wrapped
        coro = func(*args, **kwargs)
      File "/opt/workdir/.venv/lib64/python3.6/site-packages/jupyterhub/spawner.py", line 968, in start
        env = self.get_env()
      File "/opt/workdir/.venv/lib64/python3.6/site-packages/jupyterhub/spawner.py", line 960, in get_env
        env = self.user_env(env)
      File "/opt/workdir/.venv/lib64/python3.6/site-packages/jupyterhub/spawner.py", line 947, in user_env
        home = pwd.getpwnam(self.user.name).pw_dir
    KeyError: 'getpwnam(): name not found: pafer'

Any explanation to help me to fix this ?

Thanks a lot !

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
datakidcommented, Aug 20, 2018

Yep, that was the missing conf. Now I get a new error, but it’s not ldap. Thank’s @dhirschfeld

1reaction
datakidcommented, Aug 20, 2018

I see the same thing - but with a different error. Python 3.6, CentOS 7.5, up to date. Note that prompt-toolkit is not up to date because I’m seeing the same issue everyone else is - prompt-toolkit v 2 is broken.

[E 2018-08-20 13:18:37.112 JupyterHub web:1670] Uncaught exception POST /hub/login?next= (10.126.160.102)
    HTTPServerRequest(protocol='https', host='10.126.17.229', method='POST', uri='/hub/login?next=', version='HTTP/1.1', remote_ip='10.126.160.102')
    Traceback (most recent call last):
      File "/usr/local/lib64/python3.6/site-packages/tornado/web.py", line 1592, in _execute
        result = yield result
      File "/usr/local/lib/python3.6/site-packages/jupyterhub/handlers/login.py", line 81, in post
        user = await self.login_user(data)
      File "/usr/local/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 473, in login_user
        authenticated = await self.authenticate(data)
      File "/usr/local/lib/python3.6/site-packages/jupyterhub/auth.py", line 257, in get_authenticated_user
        authenticated = await maybe_future(self.authenticate(handler, data))
      File "/usr/lib64/python3.6/types.py", line 248, in wrapped
        coro = func(*args, **kwargs)
      File "/usr/local/lib/python3.6/site-packages/ldapauthenticator/ldapauthenticator.py", line 301, in authenticate
        resolved_username = self.resolve_username(username)
      File "/usr/local/lib/python3.6/site-packages/ldapauthenticator/ldapauthenticator.py", line 237, in resolve_username
        attributes=[self.lookup_dn_user_dn_attribute]
      File "/usr/local/lib/python3.6/site-packages/ldap3/core/connection.py", line 760, in search
        if ';' in attribute_name:  # remove tags
    TypeError: argument of type 'NoneType' is not iterable
    
[E 2018-08-20 13:18:37.118 JupyterHub log:150] {
      "X-Forwarded-Host": "10.126.17.229",
      "X-Forwarded-Proto": "https",
      "X-Forwarded-Port": "443",
      "X-Forwarded-For": "10.126.160.102",
      "Content-Length": "52",
      "Content-Type": "application/x-www-form-urlencoded",
      "Upgrade-Insecure-Requests": "1",
      "Connection": "close",
      "Dnt": "1",
      "Cookie": "csrftoken=l3SmEGARFIoFQfHjAVK9S6h3YgpgRNweZj9Cu9RfkOzsnxg8Mq5iYuvdTGyRrp1L",
      "Referer": "https://10.126.17.229/hub/login",
      "Accept-Encoding": "gzip, deflate, br",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
      "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0",
      "Host": "10.126.17.229"
    }

My config looks like:

c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
c.LDAPAuthenticator.lookup_dn = True
c.LDAPAuthenticator.server_address = 'ldap.company.com'
c.LDAPAuthenticator.bind_dn_template = []
c.LDAPAuthenticator.use_ssl = True
c.LDAPAuthenticator.valid_username_regex = '[a-zA-Z\- ]*'
c.LDAPAuthenticator.user_search_base = 'dc=company,dc=com'
c.LDAPAuthenticator.user_attribute = 'sAMAccountName'
c.LDAPAuthenticator.lookup_dn_search_user = 'ad-domain\\rcf_utility_user'
c.LDAPAuthenticator.lookup_dn_search_password = 'B4bSecxT6aZZZ'

and

[root@jhserver ~]# pip list              
Package                      Version  
---------------------------- ---------
alembic                      1.0.0    
async-generator              1.10     
backcall                     0.1.0    
bleach                       2.1.3    
certifi                      2018.8.13
chardet                      3.0.4    
decorator                    4.3.0    
entrypoints                  0.2.3    
html5lib                     1.0.1    
idna                         2.7      
ipykernel                    4.8.2    
ipython                      6.5.0    
ipython-genutils             0.2.0    
jedi                         0.12.1   
Jinja2                       2.10     
jsonschema                   2.6.0    
jupyter-client               5.2.3    
jupyter-console              5.2.0    
jupyter-core                 4.4.0    
jupyterhub                   0.9.2    
jupyterhub-ldapauthenticator 1.2.2    
ldap3                        2.5.1    
Mako                         1.0.7    
MarkupSafe                   1.0      
mistune                      0.8.3    
nbconvert                    5.3.1    
nbformat                     4.4.0    
notebook                     5.6.0    
pamela                       0.3.0    
pandocfilters                1.4.2    
parso                        0.3.1    
pexpect                      4.6.0    
pickleshare                  0.7.4    
pip                          18.0     
prometheus-client            0.3.1    
prompt-toolkit               1.0.15   
ptyprocess                   0.6.0    
pyasn1                       0.4.4    
Pygments                     2.2.0    
python-dateutil              2.7.3    
python-editor                1.0.3    
python-oauth2                1.1.0    
pyzmq                        17.1.2   
requests                     2.19.1   
Send2Trash                   1.5.0    
setuptools                   40.0.0   
simplegeneric                0.8.1    
six                          1.11.0   
SQLAlchemy                   1.2.10   
terminado                    0.8.1    
testpath                     0.3.1    
tornado                      5.1      
traitlets                    4.3.2    
urllib3                      1.23     
wcwidth                      0.1.7    
webencodings                 0.5.1    
wheel                        0.31.1   
Read more comments on GitHub >

github_iconTop Results From Across the Web

apache - basic authentication error 500 - Stack Overflow
Then you're looking in the wrong log or something is misconfigured. A 500 error must create a log entry somewhere. (The error is...
Read more >
How to Fix HTTP ERROR 500 in ECP/EAC after Login
Summary: HTTP ERROR 500 in Exchange is displayed when the server rejects the request to establish a connection with the Exchange Server.
Read more >
HTTP 500 Internal Server Error: What It Means & How to Fix It
A 500 internal server error is, as the name implies, a general problem with the website's server. More than likely, this means there's...
Read more >
500 Internal Server Error - HTTP - MDN Web Docs - Mozilla
This error response is a generic "catch-all" response. Usually, this indicates the server cannot find a better 5xx error code to response.
Read more >
500 Internal Server Error [Complete Guide on How to Fix It]
How to fix HTTP error 500 if you are a website user? · Reload the webpage. The 500 Server mistake can be a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found