Common Issues
Solutions to frequently encountered problems in Artbase Studio.
Authentication Issues
"Invalid JWT" Error
Symptoms: API requests fail with 401 Unauthorized
Causes:
- Expired JWT token
- Mismatched Supabase keys
- Clock skew between client and server
Solutions:
-
Refresh the session:
const { data, error } = await supabase.auth.refreshSession(); -
Verify environment variables:
# Check Supabase URL matches
echo $NEXT_PUBLIC_SUPABASE_URL -
Clear local storage and re-login
"Permission Denied" on Database Query
Symptoms: Query returns empty or throws RLS error
Causes:
- User not in organization
- Missing RLS policy
- Wrong user context
Solutions:
-
Check organization membership:
SELECT * FROM organization_members
WHERE user_id = 'your-user-id'; -
Verify RLS policies:
SELECT * FROM pg_policies
WHERE tablename = 'your_table'; -
Test with service role (temporarily):
const adminClient = createClient(url, serviceRoleKey);
OAuth Login Fails
Symptoms: Redirect loop or callback error
Causes:
- Misconfigured redirect URLs
- Missing OAuth credentials
- CORS issues
Solutions:
- Verify redirect URL in Supabase Dashboard
- Check OAuth provider credentials
- Ensure HTTPS in production
Checkout Issues
Payment Intent Creation Fails
Symptoms: "Error creating payment intent"
Causes:
- Invalid Stripe key
- Missing required fields
- Stripe account issue
Solutions:
-
Verify Stripe keys:
# Test API key
curl https://api.stripe.com/v1/balance \
-u sk_test_xxx: -
Check request payload:
console.log({ amount, currency, customer_email }); -
Review Stripe Dashboard for errors
Platform Fee Not Calculated
Symptoms: Orders show $0 platform fee
Causes:
- Founding artist exemption active
- Missing plan configuration
- Organization not linked to plan
Solutions:
-
Check founding artist status:
SELECT is_founding_artist, founding_artist_start_date
FROM organizations WHERE id = 'org-id'; -
Verify plan has commission rate:
SELECT features->>'commission_rate' FROM plans
WHERE id = 'plan-id';
Webhook Not Processing
Symptoms: Orders not created after successful payment
Causes:
- Wrong webhook secret
- Endpoint not deployed
- Signature verification failing
Solutions:
-
Verify webhook secret in environment:
echo $STRIPE_WEBHOOK_SECRET -
Check Stripe webhook logs:
- Stripe Dashboard → Developers → Webhooks
-
Test webhook locally:
stripe listen --forward-to localhost:3000/api/webhooks/stripe
Channel Sync Issues
Etsy Orders Not Syncing
Symptoms: No new orders appearing from Etsy
Causes:
- Expired OAuth tokens
- API rate limiting
- Sync service not running
Solutions:
-
Check token expiry:
SELECT token_expires_at FROM channel_accounts
WHERE channel_id = (SELECT id FROM channels WHERE slug = 'etsy'); -
Review sync service logs:
railway logs --service etsy-sync -
Re-authorize Etsy connection
"Invalid Grant" OAuth Error
Symptoms: Token refresh fails
Causes:
- Refresh token expired
- User revoked access
- Encryption key mismatch
Solutions:
- Disconnect and reconnect channel
- Verify encryption key matches across services
- Check Etsy app permissions
Email Issues
Emails Not Sending
Symptoms: Campaign shows "sent" but no deliveries
Causes:
- Invalid Resend API key
- Domain not verified
- Subscriber list empty
Solutions:
-
Verify Resend API key:
curl -X POST https://api.resend.com/emails \
-H "Authorization: Bearer re_xxx" \
-d '{"from": "test@yourdomain.com", "to": "test@example.com", "subject": "Test"}' -
Check domain verification in Resend Dashboard
-
Verify subscribers exist:
SELECT COUNT(*) FROM email_subscribers
WHERE org_id = 'org-id' AND status = 'active';
High Bounce Rate
Symptoms: Many emails bouncing
Causes:
- Invalid email addresses
- Spam complaints
- Domain reputation issues
Solutions:
-
Clean subscriber list:
UPDATE email_subscribers
SET status = 'bounced'
WHERE email IN (SELECT email FROM bounced_emails); -
Implement double opt-in
-
Review email content for spam triggers
Performance Issues
Slow Page Load
Symptoms: Pages taking >3 seconds to load
Causes:
- Large API responses
- Missing database indexes
- Unoptimized queries
Solutions:
-
Add pagination:
const { data } = await supabase
.from('products')
.select('*')
.range(0, 19); -
Create indexes:
CREATE INDEX idx_products_org_status
ON products(org_id, status); -
Use React Query caching
Database Connection Exhausted
Symptoms: "Too many connections" error
Causes:
- Connection leaks
- Missing connection pooling
- Too many concurrent requests
Solutions:
- Enable PgBouncer in Supabase
- Use connection pooling URL
- Close connections properly:
// Connections auto-close with Supabase client
// Ensure not creating new clients per request
Flutter Issues
Provider Not Found
Symptoms: ProviderNotFoundException
Causes:
- Missing ProviderScope
- Wrong provider reference
- Provider not initialized
Solutions:
-
Wrap app with ProviderScope:
runApp(ProviderScope(child: MyApp())); -
Check provider is properly defined:
final myProvider = FutureProvider<Data>((ref) async {
// Implementation
});
Build Failed on iOS
Symptoms: Xcode build errors
Causes:
- Pod issues
- Missing permissions
- Swift version mismatch
Solutions:
-
Clean and rebuild:
cd ios && pod deintegrate && pod install
flutter clean && flutter run -
Update pods:
cd ios && pod update
Getting Help
If you can't resolve an issue:
- Check logs for specific error messages
- Search GitHub Issues for similar problems
- Join our Discord for community support
- Contact support with:
- Error message
- Steps to reproduce
- Environment details (browser, OS, etc.)