Skip to content

fix: Add missing api-access edge function to unblock new user login#18

Merged
amethystani merged 1 commit intomainfrom
claude/modest-jepsen
Mar 18, 2026
Merged

fix: Add missing api-access edge function to unblock new user login#18
amethystani merged 1 commit intomainfrom
claude/modest-jepsen

Conversation

@amethystani
Copy link
Contributor

Summary

  • The frontend (since commit e722eea) calls /functions/v1/api-access for access code validation, but this edge function was never deployed — causing every new user's code submission to return "Not authenticated"
  • Created supabase/functions/api-access/index.ts — handles GET /api-access (check existing access) and POST /api-access/validate (redeem a code)
  • Uses the existing access_codes and user_access tables, including max_uses, expires_at, and is_active checks that mirror the original RPC logic
  • Also includes a supabase/migrations/add_access_codes.sql guard migration (no-op against the live DB since those tables already exist)

Test plan

  • Log in via Google as a new user
  • Enter a valid admin code (e.g. CTX-ADM-5Q2F-L8YD-2026) and confirm dashboard unlocks
  • Confirm an invalid code still shows the error state
  • Confirm a previously-granted user is auto-admitted without re-entering a code

🤖 Generated with Claude Code

…new users

The frontend was calling /functions/v1/api-access (introduced in e722eea)
but the edge function was never deployed, causing all access code attempts
to return "Not authenticated". This creates and deploys the missing function
which validates codes against the existing access_codes table and records
grants in user_access.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@netlify
Copy link

netlify bot commented Mar 18, 2026

Deploy Preview for gonnaai ready!

Name Link
🔨 Latest commit b868bde
🔍 Latest deploy log https://app.netlify.com/projects/gonnaai/deploys/69baee2bc4e26200081e6bbf
😎 Deploy Preview https://deploy-preview-18--gonnaai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 31
Accessibility: 97
Best Practices: 100
SEO: 100
PWA: 80
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@amethystani amethystani merged commit 4905637 into main Mar 18, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant