Improve failure devex (#2247)
This commit is contained in:
@@ -274,7 +274,7 @@ Note: Our setup script does these two for you, but they are here for reference.
|
||||
1. Open Docker Desktop (Works for Windows, macOS, and Linux) or run Docker Daemon
|
||||
1. Run the setup script to install the necessary dependencies and setup your environment
|
||||
```bash
|
||||
skyvern/scripts/setup.sh
|
||||
./setup.sh
|
||||
```
|
||||
1. Start the server
|
||||
```bash
|
||||
|
||||
2466
poetry.lock
generated
2466
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
0
scripts/create_organization.py
Normal file → Executable file
0
scripts/create_organization.py
Normal file → Executable file
@@ -674,6 +674,18 @@ class AgentDB:
|
||||
LOG.error("UnexpectedError", exc_info=True)
|
||||
raise
|
||||
|
||||
async def get_all_organizations(self) -> list[Organization]:
|
||||
try:
|
||||
async with self.Session() as session:
|
||||
organizations = (await session.scalars(select(OrganizationModel))).all()
|
||||
return [convert_to_organization(organization) for organization in organizations]
|
||||
except SQLAlchemyError:
|
||||
LOG.error("SQLAlchemyError", exc_info=True)
|
||||
raise
|
||||
except Exception:
|
||||
LOG.error("UnexpectedError", exc_info=True)
|
||||
raise
|
||||
|
||||
async def get_organization(self, organization_id: str) -> Organization | None:
|
||||
try:
|
||||
async with self.Session() as session:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import time
|
||||
from typing import Annotated
|
||||
|
||||
import structlog
|
||||
from asyncache import cached
|
||||
from cachetools import TTLCache
|
||||
from fastapi import Header, HTTPException, status
|
||||
@@ -15,6 +16,8 @@ from skyvern.forge.sdk.db.client import AgentDB
|
||||
from skyvern.forge.sdk.models import TokenPayload
|
||||
from skyvern.forge.sdk.schemas.organizations import Organization, OrganizationAuthTokenType
|
||||
|
||||
LOG = structlog.get_logger()
|
||||
|
||||
AUTHENTICATION_TTL = 60 * 60 # one hour
|
||||
CACHE_SIZE = 128
|
||||
ALGORITHM = "HS256"
|
||||
@@ -91,6 +94,7 @@ async def _get_current_org_cached(x_api_key: str, db: AgentDB) -> Organization:
|
||||
)
|
||||
api_key_data = TokenPayload(**payload)
|
||||
except (JWTError, ValidationError):
|
||||
LOG.error("Error decoding JWT", exc_info=True)
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail="Could not validate credentials",
|
||||
|
||||
Reference in New Issue
Block a user