Troubleshooting
Solutions to common issues when implementing passkey authentication.
Browser Support
"WebAuthn is not supported"
Cause: Browser or context doesn't support WebAuthn.
Solutions:
- Ensure you're using HTTPS (or localhost for development)
- Check browser version meets minimum requirements
- Verify the page isn't in an iframe from a different origin
import { getUnsupportedReason } from 'supakeys'
const reason = getUnsupportedReason()
if (reason) {
console.log('Not supported:', reason)
}"Secure context required"
Cause: Page is served over HTTP.
Solutions:
- Use
localhostfor development - Deploy with HTTPS for production
- Use a tool like mkcert for local HTTPS
Registration Issues
"A passkey already exists on this device"
Error code: INVALID_STATE
Cause: User already registered a passkey for this account on this device.
Solution: Offer to sign in instead:
if (result.error.code === 'INVALID_STATE') {
const signInResult = await passkeys.signIn({ email })
}"Registration cancelled"
Error code: CANCELLED
Cause: User closed the WebAuthn dialog.
Solution: This is normal user behavior. Show a message and allow retry.
"Registration timed out"
Error code: TIMEOUT
Cause: User didn't complete registration within 60 seconds.
Solution: Show a message and allow retry.
Authentication Issues
"No credentials available"
Cause: No passkeys registered for this email/device combination.
Solutions:
- Check if user has registered
- Try without email hint for discoverable credentials
- Offer password fallback
"Authentication failed"
Error code: VERIFICATION_FAILED
Causes:
- Credential verification failed
- Challenge mismatch
- Counter validation failed
Solutions:
- Retry the authentication
- Check server logs for details
- If persistent, user may need to re-register
"Challenge expired"
Error code: CHALLENGE_EXPIRED
Cause: User took longer than 5 minutes to complete.
Solution: Automatically restart the flow:
if (result.error.code === 'CHALLENGE_EXPIRED') {
return passkeys.signIn() // Start fresh
}Edge Function Issues
"Edge function not found"
Cause: Function not deployed or wrong name.
Solutions:
- Deploy the function:
supabase functions deploy passkey-auth - Check function name in config matches deployment
- Verify function appears in Supabase dashboard
"Network error"
Error code: NETWORK_ERROR
Causes:
- Edge function is down
- CORS issues
- Network connectivity
Solutions:
- Check Supabase status page
- Verify function is deployed
- Check browser console for CORS errors
"Internal server error"
Cause: Edge function threw an error.
Solutions:
- Check Supabase function logs
- Verify database tables exist
- Check environment variables
Database Issues
"relation does not exist"
Cause: Migration not applied.
Solutions:
- Run migration:
supabase db push - For local:
supabase migration up - Verify tables in Supabase dashboard
"RLS policy violation"
Cause: Row Level Security blocking access.
Solutions:
- Ensure edge function uses service role
- Verify RLS policies are correctly set
- Check user authentication state
Rate Limiting
"Too many attempts"
Error code: RATE_LIMITED
Cause: Exceeded rate limits.
Default limits:
- 5 requests/minute per IP
- 10 requests/minute per email
Solutions:
- Wait 60 seconds before retrying
- Show user-friendly message
- For development, you can temporarily increase limits
Local Development
"Function not responding"
Cause: Local function server not running.
Solution: Start the function server:
supabase functions serve passkey-auth --no-verify-jwt"Cannot connect to database"
Cause: Local Supabase not running.
Solution: Start Supabase:
supabase start"JWT verification failed"
Cause: Using --no-verify-jwt but function expects auth.
Solutions:
- Continue using
--no-verify-jwtfor development - Or configure proper JWT verification
Debugging Tips
Enable Verbose Logging
const result = await passkeys.register({ email })
if (!result.success) {
console.error('Passkey error:', {
code: result.error.code,
message: result.error.message,
cause: result.error.cause,
})
}Check Edge Function Logs
supabase functions logs passkey-authInspect Network Requests
Use browser DevTools to inspect:
- Request payload to edge function
- Response from edge function
- Any error messages
Verify Database State
-- Check credentials
SELECT * FROM passkey_credentials WHERE user_id = 'your-user-id';
-- Check challenges
SELECT * FROM passkey_challenges ORDER BY created_at DESC LIMIT 10;
-- Check rate limits
SELECT * FROM passkey_rate_limits;
-- Check audit log
SELECT * FROM passkey_audit_log ORDER BY created_at DESC LIMIT 20;Getting Help
If you're still stuck:
- Check the GitHub issues
- Search existing discussions
- Open a new issue with:
- Error code and message
- Browser and OS version
- Relevant code snippet
- Edge function logs