Skip to content

Let signing up with Google create a profile again - #2384

Open
mvictor55 wants to merge 1 commit into
codeforboston:mainfrom
mvictor55:fix-google-signup-profile
Open

mvictor55 wants to merge 1 commit into
codeforboston:mainfrom
mvictor55:fix-google-signup-profile

Conversation

@mvictor55

Copy link
Copy Markdown
Collaborator

Summary

Signing up with Google has been failing in production. A Google sign-up calls finishSignupV2 with only a requested role, and the function passed the profile fields it wasn't sent on to setRole as undefined. Firestore refuses undefined, so the profile write threw after the role claim was already set. The reader saw "Something went wrong!" and was left signed in with a role but no profile: Edit Profile renders blank, they can't add legislators, and anything they submit is published as "Anonymous". Every Google sign-up in production since Nov 1 (six accounts) failed this way; email sign-ups were not affected.

  • finishSignupV2 now writes only the fields a sign-up sent, through a small signupProfile helper with unit tests. Email sign-ups send all of them, so they write exactly what they did before.
  • Firebase's auth/too-many-requests (repeated sign-in attempts, or verification emails sent too close together) now shows a readable message instead of "Something went wrong!".

Checklist

  • On the frontend, I've made my strings translate-able. (The new message joins the existing untranslated errorMessages map in components/auth/hooks.ts.)
  • If I've added shared components, I've added a storybook story. (None added.)
  • I've made pages responsive and look good on mobile. (No layout change.)
  • If I've added new Firestore queries, I've added any new required indexes to firestore.indexes.json. (None added.)

Screenshots

None: no visual change.

Known issues

  • The Google path only calls finishSignupV2 when the token has no role, so a sign-up that fails after the role claim is set for any other reason would still leave an account with no profile. Worth a follow-up so a signed-in reader without a profile gets one.
  • Separate from this PR: from about Nov 13 to Nov 20, verification emails requested on www.mapletestimony.org failed because www wasn't an authorized domain in Firebase Auth (it was added in the console on Nov 20). The auth/unauthorized-continue-uri fallback in sendVerification should have resent those emails without the return link, but it didn't rescue them, and why isn't confirmed yet. A follow-up could serve the site on one host, or build the return link on an authorized domain, so the fallback isn't needed in production.
  • Not tested end to end with a Google sign-up on the emulators. The old and new writes were checked against firebase-admin's own validation: the old one fails with the production error (undefined in field "public"), the new one passes.

Extra Deploy Steps

  • Already done in prod (Nov 20): created the missing profiles/{uid} documents for the six affected accounts, with each account's Google display name and email, role: "user", public: true and notificationFrequency: "Weekly" (the digest trigger then set nextDigestAt). None of them had testimony or drafts. Nothing to run after this deploys.

Steps to test/reproduce

  1. Run yarn --cwd functions jest src/profile/signupProfile.test.ts.
  2. After merge (which deploys functions to dev), sign up on maple-dev.vercel.app with a Google account that has never used the dev site.
  3. See no "Something went wrong!", and Edit Profile loads with your name.
  4. In the dev Firestore, profiles/{uid} has fullName, email, role: "user", public: true, notificationFrequency: "Weekly" and nextDigestAt.

Signing up with Google calls finishSignupV2 with only a requested role, and
the function passed the profile fields it wasn't sent (fullName, email,
notificationFrequency, public) on to setRole as undefined. Firestore refuses
undefined values, so the profile write threw after the role claim was set:
the reader saw "Something went wrong!" and was left signed in with a role
and no profile, which nothing afterward creates. In production every Google
sign-up since Nov 1 failed this way.

finishSignupV2 now writes only the fields a sign-up sent, through
signupProfile. Email sign-ups send all of them, so they write what they did
before.

Also: Firebase's auth/too-many-requests, which it gives for repeated sign-in
attempts or verification emails sent too close together, now reads as a
message instead of "Something went wrong!".

Verified: jest for signupProfile, including a Google sign-up's data; the old
and new writes against firebase-admin's own validation, where the old one
fails with the production error (undefined in field "public") and the new one
passes; yarn test, yarn test:website, check-types (site and functions),
check-formatting, and eslint on the changed file.
Not verified: a Google sign-up end to end on the emulators.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
maple-dev Ready Ready Preview Nov 20, 2026 10:35pm UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview – maple-dev — 2d1b9a71 Deployed Nov 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants