Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Fix(mail): Add debug log when creating a user and add documentation about email rate limit

Jonathan ARNAULTb298109cb99a
diff --git a/doc/supabase-configuration.md b/doc/supabase-configuration.md
index 515274b9..c9bc9d82 100644
--- a/doc/supabase-configuration.md
+++ b/doc/supabase-configuration.md
@@ -86,9 +86,11 @@ If you want to customize the production templates, you can go to your project da
Supabase requires additional configuration to enable Atomic CRM's email features. Have a look at the the [email features documentation](./email-features.md) to learn more about their usage and the required setup.
+Warning: Free quota for email features is very low. If you encounter problems when creating a user or reseting a password, you can increase the sending limit via a custom STMP server setup. Please refer to the [supabase documentation](https://supabase.com/docs/guides/auth/auth-smtp) if this is your case.
+
## Fequently Asked Questions
- I have a **Security Definer View** error in **Security Advisor**
You can ignore this error. This warning informs you that the `init_state` state view is public and can be called by everybody.
-This view is required to test if your CRM has been setup correctly. This view has been configured to avoid data leak.
+This view is required to test if your CRM has been setup correctly. This view has been configured to avoid data leak.
\ No newline at end of file
diff --git a/supabase/functions/users/index.ts b/supabase/functions/users/index.ts
index 05a188c7..e8903077 100644
--- a/supabase/functions/users/index.ts
+++ b/supabase/functions/users/index.ts
@@ -41,11 +41,16 @@ async function inviteUser(req: Request) {
const { error: emailError } =
await supabaseAdmin.auth.admin.inviteUserByEmail(email);
- if (!data?.user || userError || emailError) {
- console.error('Error inviting user:', userError);
+ if (!data?.user || userError) {
+ console.error(`Error inviting user: user_error=${userError}`);
return createErrorResponse(500, 'Internal Server Error');
}
+ if (!data?.user || userError || emailError) {
+ console.error(`Error inviting user, email_error=${emailError}`);
+ return createErrorResponse(500, 'Failed to send invitation mail');
+ }
+
try {
await updateSaleDisabled(data.user.id, disabled);
const sale = await updateSaleAdministrator(data.user.id, administrator);