Skip to content

fix(link): never list apps when --app-id is given - #672

Merged
netanelgilad merged 2 commits into
mainfrom
claude/inspiring-edison-55ncqj
Oct 21, 2026
Merged

netanelgilad merged 2 commits into
mainfrom
claude/inspiring-edison-55ncqj

Conversation

@netanelgilad

@netanelgilad netanelgilad commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Note

Description

base44 link --app-id <id> used to call GET /api/apps purely to confirm the ID was in that list before writing .app.jsonc. That listing is a platform route a scoped workspace API key (BASE44_API_KEY) is refused on, and it only covers the 50 most recently updated apps — so linking failed in CI with Unauthorized. ['api_key'] -> Object not found, and a valid older app could be reported "not found" even for a logged-in user. With an explicit ID, link now writes the config directly; a wrong ID fails on the first request that actually addresses the app, which already checks the ID (and, for a key, its workspace, scope and app binding). link without an ID still lists apps for the interactive picker.

Related Issue

Same workspace-key gap as #671 (published-url). Surfaced by base44/apps-examples#17.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • packages/cli/src/cli/commands/project/link.ts: the "choose" path now fetches the project list only when no app ID was given. An explicit --app-id (or the legacy --project-id/--projectId) goes straight to writeAppConfig + setAppContext.
  • Dropped the client-side projects.find(...) existence check and its InvalidInputError ("App with ID ... not found"); validation moves to the server on the first request that addresses the app.
  • packages/cli/tests/cli/link.spec.ts: new case asserting link --app-id succeeds and writes the app ID when a workspace API key is set and GET /api/apps returns 401 — it failed before this change.
  • Existing --app-id / --project-id / --projectId / managed-source-code tests no longer mock listProjects, proving the listing is never requested.
  • CHANGELOG.md: entry under Fixed.

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

link and env-token-auth specs: 27 passed. bun run typecheck, bun run lint and knip clean.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated docs/ (AGENTS.md) if I made architectural changes

Additional Notes

Behavioural trade-off: a bad --app-id is no longer caught at link time, so .app.jsonc is written and the failure surfaces on the next command that talks to the app. That is the same error the old listing check was approximating, and it avoids both the 50-app truncation and the workspace-key refusal. No docs/ change — this alters command behaviour, not architecture.


🤖 Generated by Claude | 2026-10-21 14:15 UTC | b7a4085

`link --app-id` confirmed the ID by listing apps, a platform route that refuses
a workspace key, so a CI `base44 link --app-id` with BASE44_API_KEY failed with
`Error listing projects: Unauthorized`. With a workspace key it now links
directly; the key is checked against the app on its first app request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tmb4PCrrV2SLRpBjkGAgXJ
@netanelgilad netanelgilad self-assigned this Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.2.1-pr.672.b7a4085

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.2.1-pr.672.b7a4085"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.2.1-pr.672.b7a4085"
  }
}

Preview published to npm registry — try new features instantly!

The listing only confirmed an explicit id, covered just the 50 most recently
updated apps, and is refused to a workspace key. The first request that
addresses the app checks the id anyway.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tmb4PCrrV2SLRpBjkGAgXJ
@netanelgilad netanelgilad changed the title fix(link): link --app-id with a workspace API key without listing apps fix(link): never list apps when --app-id is given Oct 21, 2026
netanelgilad pushed a commit to base44/apps-examples that referenced this pull request Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Verified end to end with this PR's preview (@base44-preview/cli@0.2.1-pr.672.b7a4085) in base44/apps-examples' deploy workflow, using a workspace BASE44_API_KEY. base44 link --app-id "$APP_ID" linked without listing apps (Project linked successfully), and base44 deploy -y --build --git-hash "$GITHUB_SHA" then exited 0 (App deployed successfully). The same link step on 0.2.1 failed at Error listing projects: Unauthorized.


Generated by Claude Code

@netanelgilad
netanelgilad merged commit 453e64f into main Oct 21, 2026
16 checks passed
@netanelgilad
netanelgilad deleted the claude/inspiring-edison-55ncqj branch October 21, 2026 14:23
netanelgilad pushed a commit to base44/apps-examples that referenced this pull request Oct 21, 2026
0.2.2 carries base44/cli#672: `link --app-id` no longer lists apps, which a
workspace API key is refused on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tmb4PCrrV2SLRpBjkGAgXJ
netanelgilad added a commit to base44/apps-examples that referenced this pull request Oct 21, 2026
0.2.2 carries base44/cli#672: `link --app-id` no longer lists apps, which a
workspace API key is refused on.


Claude-Session: https://claude.ai/code/session_01Tmb4PCrrV2SLRpBjkGAgXJ

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants