posit-dev / posit-dev/rsconnect-python

KeyError: 'id' when deploying jupyter notebook

Open
#523 11 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

We have a report of a keyerror when deploying a jupyter notebook.

After doing some code reading, it's unclear to me how this could occur if we get a successful response from self.app_create

https://github.com/rstudio/rsconnect-python/blob/b583723fbc0157f2ed83d8501aeaadb9baa51f06/rsconnect/api.py#L253-L257

We'll follow up with additional diagnostic information but I thought we should file an issue here in case others have run into this problem.

rsconnect deploy notebook -v ./snowflake_pythonconnector_demo.ipynb

Connect detected CLI commands and/or environment variables that overlap with stored credential.

Check your environment variables (e.g. CONNECT_API_KEY) to make sure you want them to be used.
Credential paremeters are taken with the following precedence: stored > CLI > environment.
To ignore an environment variable, override it in the CLI with an empty string (e.g. -k '').
Validating server... [OK]
Validating app mode... [OK]
Making bundle ...[VERBOSE] 2023-11-02T09:43:20-0500 Adding file: manifest.json
[VERBOSE] 2023-11-02T09:43:20-0500 Adding file: requirements.txt
[VERBOSE] 2023-11-02T09:43:20-0500 Adding file: ./snowflake_pythonconnector_demo.ipynb
  [OK]
Deploying bundle ... [ERROR]: 'id'

Traceback (most recent call last):
  File "/Users/user/.pyenv/versions/3.9.15/lib/python3.9/site-packages/rsconnect/main.py", line 96, in wrapper
    result = func(*args, **kwargs)
  File "/Users/user/.pyenv/versions/3.9.15/lib/python3.9/site-packages/rsconnect/main.py", line 901, in deploy_notebook
    ce.deploy_bundle().save_deployed_info().emit_task_log()
  File "/Users/user/.pyenv/versions/3.9.15/lib/python3.9/site-packages/rsconnect/log.py", line 189, in wrapper
    result = method(self, *args, **kw)
  File "/Users/user/.pyenv/versions/3.9.15/lib/python3.9/site-packages/rsconnect/api.py", line 712, in deploy_bundle
    result = self.client.deploy(
  File "/Users/user/.pyenv/versions/3.9.15/lib/python3.9/site-packages/rsconnect/api.py", line 257, in deploy
    app_id = app["id"]
KeyError: 'id'
Internal error: 'id' 

Is it possible there's 2 api keys in play as a result of the environment var being different than the api key from the cache?

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 rsconnect/api.py at lines 253-257 and the deploy_bundle call at line 712, then reproduce the issue with rsconnect deploy notebook -v ./snowflake_pythonconnector_demo.ipynb. Inspect the response returned by self.app_create and the credential context; done means identifying why the response lacks id and providing a clear handling or diagnostic path.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.