Repository navigation
Closed
Labels
automatedOpened by an automationbugBugpriority: mediumMedium priorityservice: platformPlatform service
Description
Area
services/platform/convex/customers/ and services/platform/convex/websites/ — public mutations and actions.
Steps to reproduce
Any of the following client-triggered operations will surface a generic "Server Error" in the Convex console (and potentially leak internal details) instead of a structured ConvexError the frontend can catch and display:
- Not-found on update/delete — call
updateWebsite,deleteWebsite,updateCustomer,deleteCustomer,updateCustomers, orupdateCustomerMetadatawith an ID that does not exist, or whose org doesn't match the caller's (IDOR guard branch). - Unauthenticated — invoke any of the public
action()exports inwebsites/actions.tsor themutation()inwebsites/mutations.tswithout a valid session. - Duplicate-on-update — update a customer's email/externalId or a website's domain to one that already belongs to a different record (distinct from the duplicate-add case filed in Bug: Duplicate website/customer/vendor add throws a raw Error (not ConvexError) → uncaught Server Error in the client console #1993).
- Validation — call
createCustomerPublicwith a blank email (after trimming to empty), or callupdateCustomerswithout providing eithercustomerIdororganizationId. - Crawler not found — in
websites/actions.ts updateWebsite, whenupdateCrawlerScanIntervalsurfaces aCRAWLER_WEBSITE_NOT_FOUNDsentinel, the re-throw is a rawErrornot aConvexError.
Expected
All user-facing error paths throw ConvexError({ code: '...' }) so the client's .onError / ConvexError catch block receives a typed, displayable error instead of a generic server-error boundary activation.
Actual
Raw throw new Error(...) is used, which Convex treats as an unhandled server error, logs it to the Convex dashboard as a 500, and does not deliver a structured payload to the client.
Evidence
| File | Line | Message |
|---|---|---|
services/platform/convex/websites/actions.ts |
32, 64, 113, 154, 227 | 'Unauthenticated' |
services/platform/convex/websites/actions.ts |
38, 119, 160 | 'Website not found' (in loadOwnedWebsite and deleteWebsite/updateWebsite handlers) |
services/platform/convex/websites/actions.ts |
199 | 'Website not found in crawler. Please delete and re-add it.' |
services/platform/convex/websites/mutations.ts |
22, 27 | 'Unauthenticated' / 'Website not found' |
services/platform/convex/websites/update_website.ts |
41, 49 | 'Website not found' (not-found + IDOR guard) |
services/platform/convex/websites/update_website.ts |
68 | 'Website with domain X already exists' (update-path duplicate, separate from #1993 create-path) |
services/platform/convex/websites/delete_website.ts |
15 | 'Website not found' |
services/platform/convex/customers/update_customer.ts |
42 | 'Customer not found' |
services/platform/convex/customers/update_customer.ts |
76, 80 | 'Customer with email/externalId X already exists' (update-path duplicate, separate from #1993) |
services/platform/convex/customers/delete_customer.ts |
16 | 'Customer not found' |
services/platform/convex/customers/update_customers.ts |
74, 86, 95 | Safety validation / not-found |
services/platform/convex/customers/update_customer_metadata.ts |
30 | 'Customer not found: X' |
services/platform/convex/customers/create_customer_public.ts |
34 | 'Email is required' |
Notes
websites/bulk_create_websites.ts:42is excluded — the duplicate-domain throw is caught internally and folded into aresults.errors[]array; it never propagates to the client as a raw error.websites/internal_actions.ts:49,69are excluded — these are infrastructure/sentinel throws ininternalActionhelpers, not directly client-callable.customers/create_customer_public.ts:47,63(duplicate-create) is covered by Bug: Duplicate website/customer/vendor add throws a raw Error (not ConvexError) → uncaught Server Error in the client console #1993.websites/create_website.ts:43(duplicate-create) is covered by Bug: Duplicate website/customer/vendor add throws a raw Error (not ConvexError) → uncaught Server Error in the client console #1993.- Convention:
throw new ConvexError({ code: 'WEBSITE_NOT_FOUND' })— seeservices/platform/convex/tasks/mutations.tsfor the established pattern.
Metadata
Metadata
Assignees
Labels
automatedOpened by an automationbugBugpriority: mediumMedium priorityservice: platformPlatform service
Activity
fix(convex): throw ConvexError codes from customer/website ops (#2003) (