bug: `projects create-platform` fails with "Access to this API is forbidden" in CLI v16
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 75/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- node.js, typescript
- Lĩnh vực
- cli
Hướng nghiên cứu
Bắt đầu trong dist/cli.cjs tại getProjectsClient và so sánh với phần triển khai trước đó trong lib/commands/projects.js. Tái hiện appwrite projects create-platform bằng CLI v16, xác minh rằng tất cả các lệnh con của projects đều sử dụng client Console và xác nhận rằng lỗi truy cập bị cấm không còn xảy ra.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Install
[email protected] - Run
appwrite login - Run:
appwrite projects create-platform \ --project-id <your-project-id> \ --type web \ --name "My App" \ --hostname localhost - 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
- Ngôn ngữ chính
- Go
- Star
- 103
- Fork
- 45
- Merge trung bình
- 4 giờ 2 phút
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue tương tự
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
wakatime/wakatime-cli#1649 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
danielgtaylor/huma#1135 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
stacklok/toolhive-catalog#1734 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Docs: how to get more careful answers (Effort, reasoning models, Reasoning level, Deliberate)Đang mởdocumentation priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
yeixio/toskar-core#697 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
keyxmakerx/Chronicle#1532 ·
Maintainer thường phản hồi trong vòng 1 ngày