Skip to content

Commit

Permalink
fix (backend): resolve AssertionError when creating app from the cli …
Browse files Browse the repository at this point in the history
…due to missing workspace_id
  • Loading branch information
aybruhm committed Oct 11, 2024
1 parent 1dcccf2 commit 3e2aaa1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions agenta-backend/agenta_backend/routers/app_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@ async def create_app(
request.state.user_id,
Permission.CREATE_APPLICATION,
)

workspace_id_from_apikey = await db_manager_ee.get_workspace_id_from_apikey(
api_key_from_headers, request.state.user_id
)
if payload.workspace_id is None:
payload.workspace_id = workspace_id_from_apikey

try:
user_org_workspace_data = await get_user_org_and_workspace_id(
request.state.user_id
Expand Down
6 changes: 4 additions & 2 deletions agenta-backend/agenta_backend/routers/variants_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,16 @@ async def start_variant(

if action.action == VariantActionEnum.START:
url: URI = await app_manager.start_variant(
app_variant_db, str(app_variant_db.project_id), envvars
app_variant_db,
str(app_variant_db.project_id),
envvars,
request.state.user_id,
)

# Deploy to production
await db_manager.deploy_to_environment(
environment_name="production",
variant_id=str(app_variant_db.id),
project_id=str(app_variant_db.project_id),
user_uid=request.state.user_id,
)
return url
Expand Down

0 comments on commit 3e2aaa1

Please sign in to comment.