Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

bug: `projects create-platform` fails with "Access to this API is forbidden" in CLI v16

Aperta Adatta ai principianti
#282 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
node.js, typescript
Ambito
cli

Direzione di ricerca

Inizia in dist/cli.cjs da getProjectsClient e confrontalo con l’implementazione precedente in lib/commands/projects.js. Riproduci appwrite projects create-platform con CLI v16, verifica che tutti i sottocomandi di projects utilizzino il client Console e conferma che l’errore di accesso negato non si verifichi più.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug Description

Running appwrite projects create-platform fails with:

Error: Access to this API is forbidden.

And if no appwrite.config.json exists in the current directory, it fails earlier with:

Error: Project is not set. Please run appwrite init project to initialize...

Steps to Reproduce

  1. Install [email protected]
  2. Run appwrite login
  3. Run:
    appwrite projects create-platform \
      --project-id <your-project-id> \
      --type web \
      --name "My App" \
      --hostname localhost
    
  4. Observe: Error: Access to this API is forbidden.

Root Cause

In dist/cli.cjs, getProjectsClient uses sdkForProject() instead of sdkForConsole():

// ❌ Current (broken) — sets x-appwrite-project to local project ID
const getProjectsClient = async () => {
  const sdkClient = await sdkForProject();
  ...
};

The server-side projects.php enforces that x-appwrite-project must be console:

if ($project->getId() !== 'console') {
    throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN);
}

The fix is to use sdkForConsole(), which correctly sets x-appwrite-project: console. This matches the behavior of the old lib/commands/projects.js before the TypeScript migration.

// ✅ Fix
const getProjectsClient = async () => {
  const sdkClient = await sdkForConsole();
  ...
};

This affects all appwrite projects subcommands (create-platform, list-platforms, create-key, list-keys, etc.).

Environment

  • CLI version: 16.0.0
  • Appwrite server: 1.8.1 (self-hosted)
  • Node: v22.x
Lingua principale
Go
Stelle
103
Fork
45
Merge medio
1g 10h
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di appwrite/sdk-for-cli

Tutte le issue di appwrite/sdk-for-cli

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.