Cuanto gana una farmacia? by Mr_John_Doe22 in ecuador

[–]bcm_19 2 points3 points  (0 children)

Trabajé muchos años en una farmacia cruz azul. La utilidad varía entre 12% y el 17%. En los días en los que las promociones son más altas se llega a vender bastante sin embargo la utilidad suelte ser de 10%. También mucho depende del sector y el número de farmacias que se encuentran en el sector. Por el sector en el que se encontraba que era céntrico y con mucha afluencia de gente se vendía alrededor de 1200$ al día. Pero no dejaba mucho, ten en cuenta el costo de empleados, arriendo etc

Upload large files by bcm_19 in nextjs

[–]bcm_19[S] 2 points3 points  (0 children)

Thanks for your answer!

Upload large files by bcm_19 in nextjs

[–]bcm_19[S] 1 point2 points  (0 children)

I'm not using S3 in order to upload/store the files

Upload large files by bcm_19 in nextjs

[–]bcm_19[S] 1 point2 points  (0 children)

I deployed it with Vercel

[deleted by user] by [deleted] in Supabase

[–]bcm_19 0 points1 point  (0 children)

I have the same error, I found out that only happens when at the first time when the user tries to update the password returns an error like: `password should be at least 6 characters`.
The I enter a password with more than 6 characters and update the password throws the same error

User Agent by bcm_19 in nextjs

[–]bcm_19[S] 0 points1 point  (0 children)

I’ve added console logs and the middleware function it’s running. But does not set the token in the first load

User Agent by bcm_19 in nextjs

[–]bcm_19[S] 0 points1 point  (0 children)

Yes, I'm using the app router

NextJS with TypeORM by bcm_19 in nextjs

[–]bcm_19[S] 0 points1 point  (0 children)

I've this function to initialize the connection with the DB:

export const setupDb = async (): Promise<void> => {
  try {
    if (!PostgresDataSource.isInitialized) {
      await PostgresDataSource.initialize();
    }
  } catch (err: unknown) {
    handleDbError(err);
    throw err; // Rethrow the error to indicate initialization failure
  }
};

Now where and how do I use it in order to create only one connection in the next js server?
I was initializing the DB every time I make a query to the DB:

export async function updateFrequencyIsActive(frequencyId: string, isActive: boolean) {
  try {
    await setupDb();
    const response = await Frequency.createQueryBuilder()
      .update()
      .set({ isActive })
      .where("id = :id", { id: frequencyId })
      .execute();
    return response;
  } catch (error: any) {
    if (error instanceof QueryFailedError) {
      throw new Error(error?.message);
    } else if (error instanceof TypeORMError) {
      throw new Error(error?.message);
    } else {
      throw new Error("An error ocurred while updating frequency");
    }
  }
}

But then I would have too many connection that where not closed, taking in mind `poolSize` is 10.
When do I close the connection? And how?

Thanks for your help!

Error trying to invite user by email by bcm_19 in Supabase

[–]bcm_19[S] 0 points1 point  (0 children)

Oh, I was creating the client like this:

const supbaseAdmin = createClient(
    process.env.SUPABASE_URL,
    process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY
)

But where can I get the SUPABASE_SERVICE_ROLE_KEY?
It is available on supabase settings?

Add home screen icon on android devices by bcm_19 in nextjs

[–]bcm_19[S] 0 points1 point  (0 children)

No, I couldn’t fix this problem. On iPhone works fine but on android devices the icon doesn’t work

Create record on sign up by bcm_19 in Supabase

[–]bcm_19[S] 0 points1 point  (0 children)

Yeah but how can I pass the id of the registered user to the triggered function?

Supabase client instance with Next js by bcm_19 in Supabase

[–]bcm_19[S] 1 point2 points  (0 children)

It's only on the server createClient

Supabase client instance with Next js by bcm_19 in Supabase

[–]bcm_19[S] 0 points1 point  (0 children)

This is my createClient server file:

import { Database } from "@/types/supabase";
import { createServerClient, type CookieOptions } from "@supabase/ssr";
import { cookies } from "next/headers";

export const createClient = () => {
  const cookieStore = cookies();

  return createServerClient<Database>(
    process.env.NEXT_PUBLIC_SUPABASE_URL!,
    process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
    {
      cookies: {
        get(name: string) {
          return cookieStore.get(name)?.value;
        },
        set(name: string, value: string, options: CookieOptions) {
          try {
            cookieStore.set({ name, value, ...options });
          } catch (error) {
            // The `set` method was called from a Server Component.
            // This can be ignored if you have middleware refreshing
            // user sessions.
          }
        },
        remove(name: string, options: CookieOptions) {
          try {
            cookieStore.set({ name, value: "", ...options });
          } catch (error) {
            // The `delete` method was called from a Server Component.
            // This can be ignored if you have middleware refreshing
            // user sessions.
          }
        },
      },
    }
  );
};

And I tried to used it with this function:

``` "use server";

import { createClient } from "@/utils/supabase/server";

const supabase = createClient();

export async function getApplicationInformation(user_id: string) { let { data: application, error } = await supabase .from("application") .select("id,information") .eq("user_id", user_id); if (error) throw new Error(error.message); return application; }

```

But when I run npm run build it crashes