Status: Blocker — /signup endpoint returning 403 from Auth0
Context:
- Migrated from separate
AUTH0_CLI_*andAUTH0_CLIENT_*credentials to singleAUTH0_CLIENT_*set (commit 330b73a) - Both ROPC (password grant) and M2M (client_credentials grant) now use same credentials
- Code deployed and working; endpoint returns specific error messages
- Auth0 returns:
"Grant type 'client_credentials' not allowed for the client"
What Needs to Happen: Auth0 application configuration must be updated:
- Go to Auth0 Dashboard → Applications → [Application using
AUTH0_CLIENT_ID] - In "Grant Types" section, enable "Client Credentials"
- Ensure the application has permission to call the Management API (
/api/v2/) - Verify the application role/permissions include user creation
Testing After Fix:
curl -X POST https://sender-worker.alyshia-b38.workers.dev/signup \
-H "Content-Type: application/json" \
-d '{"email":"test@example.com","password":"Test123!"}'
# Should return 201 with { jwt, auth0Sub, userId, email }Related Changes:
workers/sender-worker/src/types.ts— Removed AUTH0_CLI_* fields from Env interfaceworkers/sender-worker/src/index.ts— Updated auth0CreateUser() call to use AUTH0_CLIENT_*workers/sender-worker/src/env-validation.test.ts— Updated validation testsworkers/sender-worker/src/index.test.ts— Removed AUTH0_CLI_* regression tests- All 146 tests passing ✅
Status: Complete ✅ (Commit 6d2ff74)
Coverage Added:
- 8 comprehensive e2e integration tests in
workers/sender-worker/src/index.e2e.test.ts - Tests for all 7 ERROR_CODE constants added in credential migration
- Error detail field validation (truncation to 200 chars)
- Real-world error scenarios based on actual Auth0/Supabase failures
Test Scenarios:
- AUTH0_TOKEN_EXCHANGE_FAILED: Client Credentials grant type not allowed
- AUTH0_USER_CREATION_FAILED: Password strength / validation errors
- SUPABASE_ORG_CREATION_FAILED: Invalid tier / org creation failures
- SUPABASE_USER_INSERT_FAILED: Constraint violations / duplicate users
- SUPABASE_ORG_MEMBERSHIP_FAILED: Invalid organization / permission errors
- Error detail field truncation validation
- INTERNAL_ERROR: Unmapped error fallback
How to Run (when e2e runner is fixed):
npm run test:e2eDocumentation: workers/sender-worker/src/ERROR_SCENARIO_TESTS.md
Status: Optional cleanup after Auth0 configuration is fixed
Context: Currently error responses include a detail field with the full Auth0/Supabase error message (truncated to 200 chars). This was added for debugging the 500 error.
What to Do:
- Remove the
detailfield fromhandleSignup()error response (workers/sender-worker/src/index.ts:120) - Keep error codes and message mapping for better debugging
Rationale: Detail field is useful for development/debugging but should not be exposed in production
- Objective: Fix
/signupendpoint returning 500 in production - Approach: Consolidate from separate AUTH0_CLI_* and AUTH0_CLIENT_* to single AUTH0_CLIENT_* set for both auth flows
- Status: Code complete ✅; Deployed ✅; Auth0 config required
⚠️ - Commits: 330b73a
- Tests: 146 passing, 0 failing
- Blocker: Auth0 dashboard configuration (Client Credentials grant type)