- Move all Astro files from dealplustech-astro/ to root - Archive Next.js code in _nextjs-backup/ - Update .gitignore for Astro project - Simplify project structure This completes the migration from Next.js to Astro. The Astro project is now at the root level.
222 lines
4.2 KiB
Markdown
222 lines
4.2 KiB
Markdown
# 🔬 Easypanel API Testing Results
|
|
|
|
## ✅ What Works
|
|
|
|
### 1. Authentication
|
|
```bash
|
|
curl -H "Authorization: Bearer TOKEN" \
|
|
http://110.164.146.46:3000/api/trpc/setup.getStatus
|
|
# ✅ Returns: {"result":{"data":{"json":{"isComplete":true}}}}
|
|
```
|
|
|
|
### 2. List Projects
|
|
```bash
|
|
curl -H "Authorization: Bearer TOKEN" \
|
|
http://110.164.146.46:3000/api/trpc/projects.listProjectsAndServices
|
|
# ✅ Returns project list including "customerwebsite"
|
|
```
|
|
|
|
### 3. Inspect Service
|
|
```bash
|
|
curl -H "Authorization: Bearer TOKEN" \
|
|
http://110.164.146.46:3000/api/trpc/services.app.inspectService
|
|
# ✅ Works when service exists
|
|
```
|
|
|
|
---
|
|
|
|
## ❌ What Fails - Service Creation
|
|
|
|
### Endpoint
|
|
```
|
|
POST /api/trpc/services.app.createService
|
|
```
|
|
|
|
### Schema (from OpenAPI)
|
|
```json
|
|
{
|
|
"input": {
|
|
"json": {
|
|
"projectName": "customerwebsite",
|
|
"serviceName": "my-app",
|
|
"source": {
|
|
"type": "image" | "github",
|
|
// For "image":
|
|
"image": "nginx:alpine",
|
|
"username": "...",
|
|
"password": "...",
|
|
// For "github":
|
|
"owner": "...",
|
|
"repo": "...",
|
|
"ref": "main",
|
|
"path": "..."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
### Attempts & Errors
|
|
|
|
#### Attempt 1: Basic Image
|
|
```json
|
|
{
|
|
"input": {
|
|
"json": {
|
|
"projectName": "customerwebsite",
|
|
"serviceName": "test",
|
|
"source": {
|
|
"type": "image",
|
|
"image": "nginx:alpine",
|
|
"port": 80
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
**Result:** ❌ 500 Error
|
|
```json
|
|
{
|
|
"error": {
|
|
"json": {
|
|
"message": "[{\"code\":\"invalid_type\",\"expected\":\"object\",\"received\":\"undefined\",\"path\":[],\"message\":\"Required\"}]"
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
#### Attempt 2: With Git Source
|
|
```json
|
|
{
|
|
"input": {
|
|
"json": {
|
|
"projectName": "customerwebsite",
|
|
"serviceName": "test-git",
|
|
"source": {
|
|
"type": "git",
|
|
"repository": "http://...",
|
|
"branch": "main"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
**Result:** ❌ Same "Required" error
|
|
|
|
#### Attempt 3: Using `project` instead of `projectName`
|
|
```json
|
|
{
|
|
"input": {
|
|
"json": {
|
|
"project": "customerwebsite",
|
|
"name": "test"
|
|
}
|
|
}
|
|
}
|
|
```
|
|
**Result:** ❌ Same error
|
|
|
|
---
|
|
|
|
## 🔍 Analysis
|
|
|
|
The Zod validation error `"expected":"object","received":"undefined","path":[]` suggests:
|
|
|
|
1. **Missing required field** at root level
|
|
2. **Schema mismatch** - the API expects additional fields not in OpenAPI spec
|
|
3. **Possible tRPC format issue** - Easypanel might use a different input format
|
|
|
|
---
|
|
|
|
## 💡 Hypothesis
|
|
|
|
Easypanel's `createService` endpoint might require:
|
|
|
|
### Option A: Additional Required Fields
|
|
```json
|
|
{
|
|
"input": {
|
|
"json": {
|
|
"projectName": "...",
|
|
"serviceName": "...",
|
|
"source": {...},
|
|
// Missing required fields:
|
|
"environmentVariables": [],
|
|
"domains": [],
|
|
"ports": [],
|
|
"mounts": []
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
### Option B: Different tRPC Format
|
|
```json
|
|
{
|
|
"type": "query",
|
|
"input": {...}
|
|
}
|
|
```
|
|
|
|
### Option C: Requires Project ID (not name)
|
|
```json
|
|
{
|
|
"input": {
|
|
"json": {
|
|
"project": "cmkw22b00000007tu4gim48q9", // Actual ID
|
|
"name": "test"
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## 📋 Next Steps to Debug
|
|
|
|
### 1. Capture Browser Network Traffic
|
|
1. Open Easypanel dashboard
|
|
2. Open DevTools → Network tab
|
|
3. Create a service manually
|
|
4. Inspect the exact API request
|
|
5. Copy request payload
|
|
|
|
### 2. Test with cURL
|
|
Use the exact payload from browser
|
|
|
|
### 3. Alternative: Use Easypanel CLI (if exists)
|
|
Check if Easypanel provides official CLI
|
|
|
|
### 4. Contact Easypanel Support
|
|
Ask for correct API schema for `services.app.createService`
|
|
|
|
---
|
|
|
|
## 🎯 Current Recommendation
|
|
|
|
Until API is figured out, use **manual creation**:
|
|
|
|
1. **Create service via dashboard** (2 minutes)
|
|
2. **Copy service ID**
|
|
3. **Register with skill**: `./deploy.sh register SERVICE_ID`
|
|
4. **Future updates**: Automated via `./deploy.sh update`
|
|
|
|
This is still 80% automated!
|
|
|
|
---
|
|
|
|
## 📞 Need Your Help
|
|
|
|
**Can you:**
|
|
1. Open browser DevTools when creating service in Easypanel
|
|
2. Copy the exact API request payload
|
|
3. Share it so I can update the skill?
|
|
|
|
Or if you know the correct schema, let me know!
|
|
|
|
---
|
|
|
|
**Status:** ⚠️ API schema unclear
|
|
**Workaround:** Manual creation + automated updates
|
|
**Automation Level:** 80% (will be 100% with correct schema)
|