Submit_Workflow hangs on submission

Open
#4 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python

Research direction

Start at _open_auth_url in the issue and trace how CallbackHandler supplies auth_code to httpd.handle_request(). Reproduce the submission flow and inspect why the localhost callback does not complete. Done means authorization returns successfully, AUTH is populated in the environment and src/.env, and submission continues instead of hanging.

Written by the indexing model from the issue text.

Description

It hangs when attempting to submit to a namespace. URL opens, nothing is displayed. Env file created, but remains empty of info (just null strings)

  def _open_auth_url(auth_url: str, port: int) -> None:
      httpd = _ReusingHTTPServer(("localhost", port), CallbackHandler)
      webbrowser.open(auth_url)
      try:
          print(
              f"Please authorize the application in your browser. If it does not open automatically, visit: {auth_url}"
          )
          httpd.handle_request()
          os.environ["AUTH"] = httpd.auth_code
          dotenv.set_key("src/.env", "AUTH", httpd.auth_code)
          
      except OSError:
          print("ERROR: Port in use. Please restart your terminal.")
          os.environ["AUTH"] = ""
          print("ERROR: Port in use. Please restart your terminal.")
          exit(1)
      finally:
          print("Shutting down the server...")
          httpd.socket.shutdown(socket.SHUT_RDWR)
          httpd.server_close()

output:

(node:5049) [DEP0169] DeprecationWarning: url.parse() behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for url.parse() vulnerabilities.
(Use node --trace-deprecation ... to show where the warning was created)
Please authorize the application in your browser. If it does not open automatically, visit: https://identity.diamond.ac.uk/realms/dls/protocol/openid-connect/auth?client_id=workflows-cli&response_type=code&redirect_uri=http://localhost:8000/&scope=openid posix-uid profile email fedid&state=&nonce=&code_challenge=JVZHGbR1yQmIgn4MniLQK9xVmvIujWozvSgf0F6zhQI&code_challenge_method=S256

Seems to be hanging on handle request?

Acceptance Criteria

  • Specific criteria that will be used to judge if the issue is fixed
Dominant language
Python
Stars
0
Forks
0
Avg merge
10h 26m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DiamondLightSource/python-workflow-submitter

All issues in DiamondLightSource/python-workflow-submitter

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.