posit-dev / posit-dev/rsconnect-python

KeyError: 'id' when deploying jupyter notebook

オープン
#523 コメント 11 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
37
フォーク
28
平均マージ
1日 3時間
マージ済み PR(30日)
7

説明

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?

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

rsconnect/api.py の253-257行目と、712行目の deploy_bundle 呼び出しから始め、rsconnect deploy notebook -v ./snowflake_pythonconnector_demo.ipynb で問題を再現します。self.app_create が返すレスポンスと credential context を調査します。レスポンスに id がない理由を特定し、明確な処理または診断の手順を示せれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
jupyter-notebook, python
領域
cli
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。