Architecture: Test Share Feature - Step by Step
Date: 2026-01-30
Debugging
Check if Conversation Exists in MongoDB
Browser Console:
// Get current conversation ID from URL
const conversationId = window.location.pathname.split('/').pop();
console.log("Current conversation ID:", conversationId);
// Check if it exists in MongoDB
fetch(`/api/chat/conversations/${conversationId}`)
.then(res => res.json())
.then(data => console.log("✅ Conversation exists in MongoDB:", data))
.catch(err => console.error("❌ Conversation NOT in MongoDB:", err));
Check MongoDB Direct Connection
Terminal:
# Connect to MongoDB
docker exec -it ai-platform-engineering-mongodb-1 mongosh -u admin -p changeme
# In MongoDB shell:
use caipe
# List all conversations
db.conversations.find({}).pretty()
# Count conversations
db.conversations.countDocuments()
# Exit
exit
Check MongoDB via mongo-express
- Open: http://localhost:8081
- Login: admin / changeme
- Click "caipe" database
- Click "conversations" collection
- You should see your conversations listed
Common Issues
Issue: "MongoDB connection refused"
Solution:
docker-compose --profile caipe-ui-dev up -d mongodb
docker-compose logs mongodb
Issue: "Conversation not found" even with new conversation
Check:
- MongoDB is running:
docker ps | grep mongodb - Conversation was created via API: Check browser network tab for
POST /api/chat/conversations - Response includes
_idfield - URL contains the MongoDB UUID
Debug API Call:
// In browser console after clicking "New Chat"
fetch('/api/chat/conversations', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ title: 'Test Conversation' })
})
.then(res => res.json())
.then(data => console.log("✅ Created:", data))
.catch(err => console.error("❌ Failed:", err));
Issue: Share dialog doesn't appear centered
Check:
- Clear browser cache: Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)
- Check for z-index conflicts in browser DevTools
- Verify
document.bodyis not styled withposition: relative
Issue: User search returns no results
Check:
- User has logged in at least once:
db.users.find({email: "sraradhy@cisco.com"}) - API endpoint works:
curl http://localhost:3000/api/users/search?q=sraradhy - Authentication is working
Related
- Spec: spec.md