patterns-app / patterns-devkit

Data pipelines from re-usable components
BSD 3-Clause "New" or "Revised" License
106 stars 5 forks source link

Login fails when the environment is invalid #123

Closed trav closed 2 years ago

trav commented 2 years ago

I've enabled stack traces in my shell, so this is atypical output. Usually it just says something like "failed to login: None"

The issue is that the environment that it is defaulting to is invalid (I believe). It says [tests/Default], which actually looks like that is going to be the value that it defaults to. However tests is one environment, and Default is a different one. Each of those is valid on their own.

~/g/b/t/slow-pipe►poetry run basis login                                                                                                                (master|💩?↓4) 09:57
Email (admin@admin.com): 
Password: 
Select an environment [tests/Default]: 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/jtravis/git/basis-devkit/basis/cli/main.py", line 83, in main
    app()
  File "/Users/jtravis/git/basis-devkit/.venv/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jtravis/git/basis-devkit/.venv/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/Users/jtravis/git/basis-devkit/.venv/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/jtravis/git/basis-devkit/.venv/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jtravis/git/basis-devkit/.venv/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/Users/jtravis/git/basis-devkit/.venv/lib/python3.9/site-packages/typer/main.py", line 500, in wrapper
    return callback(**use_params)  # type: ignore
  File "/Users/jtravis/git/basis-devkit/basis/cli/commands/login.py", line 33, in login
    organization_id=ids.organization_id, environment_id=ids.environment_id
  File "/opt/homebrew/Cellar/python@3.9/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/functools.py", line 982, in __get__
    val = self.func(instance)
  File "/Users/jtravis/git/basis-devkit/basis/cli/services/lookup.py", line 80, in environment_id
    return envs_by_name[env_name]["uid"]
KeyError: None