I’ve upgraded to Jupyterhub 5.0 and Notebook 6.5.7, and I’m trying to get jupyter-resource-usage 0.7.1 working. However, I get constant 500 server errors when /api/metrics/v1 is called.
[W 2024-08-02 14:49:07.055 SingleUserNotebookApp handlers:774] wrote error: 'Unhandled error'
Traceback (most recent call last):
File "/opt/conda/lib/python3.11/site-packages/tornado/web.py", line 1769, in _execute
result = await result # type: ignore
^^^^^^^^^^^^
File "/opt/conda/lib/python3.11/site-packages/jupyter_server/base/handlers.py", line 751, in prepare
await super().prepare()
File "/opt/conda/lib/python3.11/site-packages/jupyter_server/base/handlers.py", line 618, in prepare
user = User(self.get_current_user())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<string>", line 9, in __init__
File "/opt/conda/lib/python3.11/site-packages/jupyter_server/auth/identity.py", line 59, in __post_init__
self.fill_defaults()
File "/opt/conda/lib/python3.11/site-packages/jupyter_server/auth/identity.py", line 72, in fill_defaults
raise ValueError(msg)
ValueError: user.username must not be empty: User(username=None, name='', display_name='', initials=None, avatar_url=None, color=None)
The weird thing is that I can open this url directly from my browser and it works fine:
https://xxx/user/yyy/api/metrics/v1
{"rss": 319979520, "limits": {"memory": {"rss": 6442450944, "pss": 6442450944, "warn": false}}, "pss": 280208384}
I’m not sure what is causing this user.username error, do I need to be setting that somewhere? I use a custom authenticator which returns name.
async def authenticate(self, handler, data=None):
return {
'name': data['username'],
'auth_state': xxx
}
I don’t have a problem with authentication or the notebook executing cells, just with /api/metrics called from within the notebook, or even using curl from the notebook terminal. I’m not quite sure what could be the problem.
Thanks,
Mark