- Add .gitignore to exclude node_modules, dist, logs, and system files - Add comprehensive project documentation including README, deployment guide, and development setup - Add .kiro project specifications for amazon-product-bar-extension, appwrite-cloud-storage, appwrite-userid-repair, blacklist-feature, and enhanced-item-management - Add .kiro steering documents for product, structure, styling, and tech guidelines - Add VSCode settings configuration for consistent development environment - Add manifest.json and babel/vite configuration for extension build setup - Add complete source code implementation including AppWrite integration, storage managers, UI components, and services - Add comprehensive test suite with Jest configuration and 30+ test files covering all major modules - Add test HTML files for integration testing and validation - Add coverage reports and build validation scripts - Add AppWrite setup and repair documentation for database schema management - Add migration guides and responsive accessibility implementation documentation - Establish foundation for Amazon product bar extension with full feature set including blacklist management, enhanced item workflows, and real-time synchronization
5.8 KiB
🔧 AppWrite userId Attribute Fix - Step by Step
Current Problem ❌
Your AppWrite collections are missing the critical userId attribute. The error logs show:
Invalid query: Attribute not found in schema: userId
This happens because the extension tries to filter data by userId but the collections don't have this attribute.
Quick Fix Solution ✅
Step 1: Access Your AppWrite Console
- Go to: https://appwrite.webklar.com
- Login with your credentials
- Select project:
6963df38003b96dab5aa - Navigate to: Databases →
amazon-extension-db
Step 2: Add userId Attribute to Each Collection
You need to add the userId attribute to all 5 collections:
Collection 1: amazon-ext-enhanced-items
- Click on
amazon-ext-enhanced-items - Go to "Attributes" tab
- Click "Create Attribute"
- Select "String"
- Enter:
- Key:
userId - Size:
255 - Required: ✅ Yes
- Array: ❌ No
- Key:
- Click "Create"
Collection 2: amazon-ext-saved-products
- Click on
amazon-ext-saved-products - Go to "Attributes" tab
- Click "Create Attribute"
- Select "String"
- Enter:
- Key:
userId - Size:
255 - Required: ✅ Yes
- Array: ❌ No
- Key:
- Click "Create"
Collection 3: amazon_ext_blacklist
- Click on
amazon_ext_blacklist - Go to "Attributes" tab
- Click "Create Attribute"
- Select "String"
- Enter:
- Key:
userId - Size:
255 - Required: ✅ Yes
- Array: ❌ No
- Key:
- Click "Create"
Collection 4: amazon-ext-enhanced-settings
- Click on
amazon-ext-enhanced-settings - Go to "Attributes" tab
- Click "Create Attribute"
- Select "String"
- Enter:
- Key:
userId - Size:
255 - Required: ✅ Yes
- Array: ❌ No
- Key:
- Click "Create"
Collection 5: amazon-ext-migration-status
- Click on
amazon-ext-migration-status - Go to "Attributes" tab
- Click "Create Attribute"
- Select "String"
- Enter:
- Key:
userId - Size:
255 - Required: ✅ Yes
- Array: ❌ No
- Key:
- Click "Create"
Step 3: Fix Permissions (Critical!)
After adding userId attributes, you must fix permissions for each collection:
For EACH collection:
-
Click on the collection name
-
Go to "Settings" tab (not "Attributes")
-
Scroll down to "Permissions" section
-
Set these exact permissions:
Create Permission:
- Click "Add a permission"
- Select:
users - Click "Add"
Read Permission:
- Click "Add a permission"
- Select:
user:$userId - Click "Add"
Update Permission:
- Click "Add a permission"
- Select:
user:$userId - Click "Add"
Delete Permission:
- Click "Add a permission"
- Select:
user:$userId - Click "Add"
-
Click "Update" to save
Step 4: Test the Fix ✅
- Reload your Chrome extension
- Go to Amazon: https://amazon.de/s?k=smartphone
- Open browser console (F12)
- Check for errors - should see no more "userId" errors
- Test Enhanced Items - should work without errors
Expected Results After Fix ✅
Console should show:
✅ AppWrite connection successful
✅ Collections accessible
✅ Real-time sync working
✅ No more "Invalid query: Attribute not found in schema: userId" errors
Extension should work:
- ✅ Enhanced Items panel opens
- ✅ Items can be saved to AppWrite
- ✅ Data appears in AppWrite console
- ✅ Real-time sync between tabs
Visual Guide 📸
Finding the Attributes Tab:
AppWrite Console
└── Databases
└── amazon-extension-db
└── [Collection Name] ← Click here
├── Documents
├── Attributes ← Go here to add userId
└── Settings ← Go here for permissions
Adding userId Attribute:
Attributes Tab
└── Create Attribute
├── Type: String ← Select this
├── Key: userId ← Enter this
├── Size: 255 ← Enter this
├── Required: ✅ ← Check this
└── Array: ❌ ← Leave unchecked
Setting Permissions:
Settings Tab
└── Permissions Section
├── Create: users ← Any authenticated user can create
├── Read: user:$userId ← Users can only read their own data
├── Update: user:$userId ← Users can only update their own data
└── Delete: user:$userId ← Users can only delete their own data
Troubleshooting 🔧
Still getting "userId" errors?
- ✅ Make sure you added
userIdto ALL 5 collections - ✅ Check that
userIdis marked as "Required" - ✅ Verify the attribute name is exactly
userId(case-sensitive) - ✅ Clear browser cache and reload extension
Still getting 401 permission errors?
- ✅ Make sure permissions are set correctly for ALL collections
- ✅ Use
user:$userIdnot justusersfor Read/Update/Delete - ✅ Try logging out and back in to the extension
Collections not found?
- ✅ Make sure you're in the right project:
6963df38003b96dab5aa - ✅ Check database name:
amazon-extension-db - ✅ Collection names must match exactly (case-sensitive)
Alternative: Use Test Tool 🧪
Open this file in your browser to automatically test your collections:
test-appwrite-collections.html
This will tell you exactly which collections are missing the userId attribute.
Why This Happened 🤔
The collections were created without the userId attribute, but the extension code expects it to exist for:
- Data isolation: Each user only sees their own data
- Security: Prevents users from accessing other users' data
- Filtering: All queries filter by
userIdto get user-specific data
Adding the userId attribute and setting proper permissions fixes this issue permanently.