| title | Troubleshooting |
|---|---|
| description | Common setup, serve, deploy, auth, secret, and runtime issues. |
Start here when a Capsule command or app does not behave the way you expect.
Install cpsl in the active environment:
uv add cpslor:
pip install cpslThen verify:
which capsule
capsule --helpIf which capsule points at the wrong environment, activate the virtual environment you installed into.
Run:
capsule logincapsule login authenticates you as the builder. It is required for serve, deploy, and workspace resource commands.
Create the workspace secret:
capsule secret create OPENAI_API_KEY=sk-...Declare it on the app:
app = cpsl.App(
name="my-app",
image=cpsl.Image(),
secrets=["OPENAI_API_KEY"],
)For local-only testing, also export the environment variable before capsule serve.
Make sure the dependency is in the runtime image:
app = cpsl.App(
name="my-app",
image=cpsl.Image(python_packages=["openai", "requests"]),
)Installing a package locally is not enough. The Capsule runtime installs packages from cpsl.Image(...).
Check that the page is registered before the module finishes importing:
@app.page("Overview", icon="layout-dashboard")
def overview():
return cpsl.ui.Page([...])For React pages, check the component path:
app.add_page("Dashboard", component="pages/dashboard.tsx")If a page needs user credentials, gate it and read integrations from RequestContext.
@app.data("repos", access="authenticated")
async def repos(ctx: cpsl.RequestContext):
github = ctx.integrations.get(cpsl.Integration.GITHUB)
if not github:
return {"connected": False, "repos": []}The user still needs to connect the integration in the hosted app.
Create the filesystem and mount it:
capsule fs create reportsapp = cpsl.App(
name="reports",
image=cpsl.Image(),
filesystems={"/data": cpsl.FileSystem("reports")},
)Then create subdirectories inside the runtime before writing:
os.makedirs("/data/reports", exist_ok=True)Check SDK And Runtime Versions. Hosted runtimes can use the platform-pinned SDK version even if your local virtual environment has a different cpsl installed.