# Testing and Debugging Test your custom actions before deploying them to production Custom actions require a Pro plan or higher. Upgrade to Pro → ## Built-in Request Tester Test your actions directly in the configuration interface. ### 1. Configure Your Action Set up your URL, method, and parameters as usual. ### 2. Open Test Panel The test panel shows: - Resolved URL with variables - Headers with substitutions - Body data structure - Query parameters ### 3. Provide Test Values For AI-generated parameters, enter test values: ```json { "searchQuery": "customer support", "limit": 10, "includeArchived": false } ``` ### 4. Execute Test Click **Test Request** to: - Send actual HTTP request - View response status - Inspect response body - Check response time ### 5. Review Results ```json { "status": 200, "response": { "results": [ { "id": 123, "title": "Customer Support Guide" } ], "total": 42 }, "time": "234ms" } ``` ## Testing Strategies ### Variable Resolution Verify all variables resolve correctly: ```bash URL: {{var.BASE_URL}}/api/{{endpoint}} Header: Bearer {{var.API_KEY}} URL: https://api.example.com/api/users Header: Bearer sk-abc123... ``` ### Parameter Types Test each parameter type: | Type | Test Value | Expected | | ------- | ------------------ | ------------- | | String | `"hello world"` | Text value | | Number | `42` | Numeric value | | Boolean | `true` | Boolean value | | Object | `{"key": "value"}` | JSON object | | Array | `[1, 2, 3]` | JSON array | ### Edge Cases Test boundary conditions: - **Empty values**: Optional parameters - **Special characters**: URLs, JSON strings - **Large payloads**: Big objects/arrays - **Invalid inputs**: Error handling ## Common Issues ### Authentication Errors **401 Unauthorized** ```json { "error": "Invalid API key" } ``` **Solution**: Check your API key variable: 1. Verify the variable value 2. Check header format (`Bearer`, `Basic`, etc.) 3. Ensure secret type for sensitive values ### CORS Errors **Browser Console Error** ``` Access to fetch at 'api.example.com' from origin 'app.chipp.ai' has been blocked by CORS policy ``` **Solution**: The API must allow requests from `app.chipp.ai`: - Add `app.chipp.ai` to allowed origins - Or use a proxy endpoint - Or implement server-side execution ### Variable Not Resolving **Issue**: `{{var.API_KEY}}` appears literally in request **Debug Steps**: 1. Check variable exists in Variables tab 2. Verify exact name match (case-sensitive) 3. Ensure variable has a value 4. Check syntax: `{{var.NAME}}` ### JSON Parse Errors **Issue**: Body parameters not formatting correctly ```json // Bad { "data": "{"nested": "value"}" } // Good { "data": { "nested": "value" } } ``` **Solution**: Use proper type (Object/Array) for nested data ## Debug Mode Enable detailed logging for troubleshooting: ### Request Details View the exact request being sent: ```bash POST https://api.example.com/endpoint Headers: Authorization: Bearer [REDACTED] Content-Type: application/json Body: { "query": "test search", "filters": { "status": "active" } } ``` ### Response Details Inspect full response: ```json { "status": 200, "headers": { "content-type": "application/json", "x-request-id": "req_123" }, "body": { "success": true, "data": [...] } } ``` ## Testing Dependencies For actions with dependencies: ### 1. Test Prerequisites First ```bash GET /api/user → Returns {"id": 123} GET /api/users/123/details → Uses output from Action 1 ``` ### 2. Simulate Dependency Output Test with mock values: - Manually provide expected values - Verify parameter mapping - Check JSONPath selectors ### 3. Test Full Chain In conversation: 1. Trigger first action 2. Verify output stored 3. Trigger dependent action 4. Confirm value passed correctly ## Performance Testing ### Response Times Monitor action performance: | Metric | Good | Warning | Bad | | ------------- | ------ | ---------- | ------- | | Response Time | <500ms | 500-2000ms | >2000ms | | Timeout | - | - | 30s | ### Optimization Tips 1. **Use pagination** for large datasets 2. **Cache responses** when appropriate 3. **Minimize payload size** 4. **Use specific field selection** ## Error Handling ### Graceful Failures Design actions to fail gracefully: ```json { "success": false, "error": { "code": "RESOURCE_NOT_FOUND", "message": "User with ID 123 not found" } } ``` ### Retry Logic For transient failures: - Network timeouts - Rate limiting - Temporary server errors ### User-Friendly Messages AI receives and can relay error context: ```json { "error": "Unable to send email: recipient address invalid" } ``` ## Production Checklist Before using in production: ### Security - [ ] API keys in secret variables - [ ] HTTPS endpoints only - [ ] No sensitive data in URLs - [ ] Proper authentication headers ### Reliability - [ ] All parameters tested - [ ] Error responses handled - [ ] Dependencies verified - [ ] Timeouts configured ### Performance - [ ] Response times acceptable - [ ] Payload sizes optimized - [ ] Rate limits considered - [ ] Caching implemented ### Documentation - [ ] Clear action descriptions - [ ] AI instructions complete - [ ] Example values provided - [ ] Variable purposes documented ## Troubleshooting Guide | Issue | Cause | Solution | | ---------------------- | ----------------- | ------------------------------------- | | Variables not replaced | Syntax error | Check `{{var.NAME}}` format | | Auth fails | Wrong credentials | Update variable value | | Timeout | Slow API | Optimize endpoint or increase timeout | | Wrong data | Bad JSONPath | Test path selector | | No response | CORS/Network | Check API accessibility | ## Next Steps - [View Examples →](/docs/custom-actions/examples) - [Parameter Configuration →](/docs/custom-actions/parameters) - [Manage Variables →](/docs/custom-actions/variables)