Build a REAL Software-as-a-Service app with AI features and payments & credits system that you might even turn into a side income or business idea using Next.js 14, Clerk, MongoDB, Cloudinary AI, and Stripe.
I tried forking your project and setting it up locally. After logging in, the UI didn't show any errors, but when trying to access the payment page, an error occurred. It turns out that the user wasn't saved to Mongodb because the webhook response from Clerk returned a null username.
Here is an example of the response from Clerk that I received:
Therefore, to prevent the same error from recurring and to ensure that the username is not null, I suggest saving the email as a replacement for the username
Hi Adrian,
Based on a question from one of the members on Discord: https://discord.com/channels/710138849350647871/710138850009284681/1265213027045871730,
I tried forking your project and setting it up locally. After logging in, the UI didn't show any errors, but when trying to access the payment page, an error occurred. It turns out that the user wasn't saved to Mongodb because the webhook response from Clerk returned a null username.
Here is an example of the response from Clerk that I received:
{ "data": { "email_addresses": [ { "email_address": "billyfebram@gmail.com" } ], "username": null }, "event_attributes": { "http_request": { "client_ip": "182.253.47.54", "user_agent": "Mozilla/5.0" } }, "object": "event", "type": "user.created" }
Therefore, to prevent the same error from recurring and to ensure that the username is not null, I suggest saving the email as a replacement for the username