posit-dev / posit-dev/rsconnect-python

stack trace when you have multiple saved servers and don't pick one

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

Nobody has claimed this yet.

Dominant language
Python
Stars
37
Forks
28
Avg merge
1d 3h
Merged PRs (30d)
7

Description

I have 3 saved/nicknamed servers. When deploying, I need to pick one using -n. When I forgot, instead of a helpful error message I got a stack trace:

❯ rsconnect deploy quarto index.qmd
Inspecting Quarto project...                     [OK]
Traceback (most recent call last):
  File "/Users/chris/content/quarto-email-install-fest/.venv/lib/python3.11/site-packages/rsconnect/main.py", line 97, in wrapper
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/chris/content/quarto-email-install-fest/.venv/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/chris/content/quarto-email-install-fest/.venv/lib/python3.11/site-packages/rsconnect/main.py", line 1219, in deploy_quarto
    ce = RSConnectExecutor(**kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/chris/content/quarto-email-install-fest/.venv/lib/python3.11/site-packages/rsconnect/api.py", line 424, in __init__
    self.setup_client(cookies)
  File "/Users/chris/content/quarto-email-install-fest/.venv/lib/python3.11/site-packages/rsconnect/api.py", line 540, in setup_client
    self.client = RSConnectClient(self.remote_server, cookies)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/chris/content/quarto-email-install-fest/.venv/lib/python3.11/site-packages/rsconnect/api.py", line 136, in __init__
    append_to_path(server.url, "__api__"),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/chris/content/quarto-email-install-fest/.venv/lib/python3.11/site-packages/rsconnect/http_support.py", line 129, in append_to_path
    if uri.endswith("/") and path.startswith("/"):
       ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'endswith'
Internal error: 'NoneType' object has no attribute 'endswith'

related: #214

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.

Research direction

Start with the deploy_quarto entry point in rsconnect/main.py and follow RSConnectExecutor through rsconnect/api.py to the server selection and URL handling shown in the traceback. Reproduce the command with multiple saved servers and no -n; done means it reports a helpful selection error instead of a stack trace.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.