pepkit / looper

A job submitter for Portable Encapsulated Projects
http://looper.databio.org
BSD 2-Clause "Simplified" License
20 stars 7 forks source link

Error: looper requires JWT for retrieving public PEP from PEPhub #516

Open nsheff opened 2 months ago

nsheff commented 2 months ago

I entered a registry path to a public PEP in my looper config.

I ran looper run and I get this error:

looper run -d -l 1 
Looper version: 2.0.0a1
Command: run
Using looper config (.looper.yaml).
Traceback (most recent call last):
  File "/home/nsheff/.local/bin/looper", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/nsheff/.local/lib/python3.12/site-packages/looper/cli_pydantic.py", line 352, in main
    return run_looper(args, parser, test_args=test_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nsheff/.local/lib/python3.12/site-packages/looper/cli_pydantic.py", line 221, in run_looper
    project_dict=PEPHubClient()._load_raw_pep(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/typing_extensions.py", line 2673, in wrapper
    return arg(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/nsheff/.local/lib/python3.12/site-packages/pephubclient/pephubclient.py", line 272, in _load_raw_pep
    return self.load_raw_pep(registry_path, query_param)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nsheff/.local/lib/python3.12/site-packages/pephubclient/pephubclient.py", line 290, in load_raw_pep
    pephub_response = self.send_request(
                      ^^^^^^^^^^^^^^^^^^
  File "/home/nsheff/.local/lib/python3.12/site-packages/pephubclient/helpers.py", line 56, in send_request
    raise ResponseError("JWT has expired. Please log in again.")
pephubclient.exceptions.ResponseError: JWT has expired. Please log in again.

It seems to me it should not error that my JWT has expired if I'm trying to do something that shouldn't need a JWT in the first place.

I'm not sure if this is a bug in looper, or PEPHubClient, or what.

nsheff commented 2 months ago

Two things:

nsheff commented 2 months ago

Maybe related to: https://github.com/pepkit/pephubclient/issues/42

donaldcampbelljr commented 2 months ago

I've added some exception messaging to alert the user that they can try running 'phc login' if they get a response error.

nsheff commented 2 months ago

Ok -- I think you did that in the wrong spot though. That should be done in the PEPhubclient error, not here!

nsheff commented 2 months ago

This appears to be a pephub API endpoint bug, actually. if it's public, why is it evaluating credentials? it should only evaluate the JWT if I'm requesting a private resource.