adrianhajdin / podcastr

https://podcastr-23zf.vercel.app
463 stars 95 forks source link

Login with email causes webhook error #6

Open ldanilek opened 3 weeks ago

ldanilek commented 3 weeks ago

When I log in with an email, not with Google, I do not have a first name, so the webhook throws this error:

Screenshot_2024-06-14_at_8 13 10_AM

which is because of the exclamation point on this line: https://github.com/adrianhajdin/podcastr/blob/e4b647350223c45e2ebee356112158545d61473e/convex/http.ts#L23

The exclamation point hides the fact that the user's first_name can be null.

Two possible fixes:

  1. change the line to name: event.data.first_name ?? "",
  2. changev.string() into v.union(v.string(), v.null()) in three places: name in createUser args and name in users schema and author in podcasts schema.