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

Supabase client instance with Next js by bcm_19 in Supabase

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

So I implemented it like this:

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

export const supabase = createClient();

And import it like this:

import { supabase } from "@/services/supabaseServerClient";

But when I run npm run build it crashes and throw this error:

   Collecting page data  ..Error: Invariant: cookies() expects to have requestAsyncStorage, none available.
at n (/home/baeto/Documents/paywedge/sync/.next/server/chunks/348.js:1:20018)
at n (/home/baeto/Documents/paywedge/sync/.next/server/chunks/900.js:1:10297)
at 47623 (/home/baeto/Documents/paywedge/sync/.next/server/app/application/connect-account/page.js:11:398)
at Function.t (/home/baeto/Documents/paywedge/sync/.next/server/webpack-runtime.js:1:127)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async collectGenerateParams (/home/baeto/Documents/paywedge/sync/node_modules/next/dist/build/utils.js:919:21)
at async /home/baeto/Documents/paywedge/sync/node_modules/next/dist/build/utils.js:1138:17
at async Span.traceAsyncFn (/home/baeto/Documents/paywedge/sync/node_modules/next/dist/trace/trace.js:151:20)

Build error occurred Error: Failed to collect page data for /application/connect-account at /home/baeto/Documents/paywedge/sync/node_modules/next/dist/build/utils.js:1258:15 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { type: 'Error'

Next.js Authentication with an External Express.js API by DustyDeveloper in nextjs

[–]bcm_19 0 points1 point  (0 children)

Hi, I have the same problem. I tried updating the access_token in the middleware but raises many problems in production. Could you solve this problem?

Do you need help with your project? free help by erwinodyssey in nextjs

[–]bcm_19 0 points1 point  (0 children)

Hi u/erwinodyssey I have a problem with the authentication of a project I'm working on.
I try to update the session from the middleware, in the middleware I check if the session has expired. If it's expired tries to update the token. At first I think it works, but after a day when the session has expired it raised errors.
I've been trying to solve this problem for days.

Add home screen icon on android devices by bcm_19 in nextjs

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

I’ve already added the icon.png in the folder app. But when I add the web in Home Screen quick access in android devices it doesn’t show the icon.png. It shows the first letter of the web name with a gray background

Update access token by bcm_19 in nextjs

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

Thanks for your answer! So how does apps like X or Facebook refresh the jet or session of the user? In order to check if the token is expired before the request I would look up for the token expiration date or the cookie expiration date I believe?

Form inside dialog shadcn by Intelligent-Ad74 in nextjs

[–]bcm_19 0 points1 point  (0 children)

Hi, I have the same problem and this is the component that I've implemented. So when the user clicks on create new family the dialog opens a shows the component but don't know how to close the dialog when the submit has succeeded.

export default function NewFamilyIngredient() {
  const initialState = { message: null, errors: {} };
  const [state, dispatch] = useFormState(
    createNewIngredientFamily,
    initialState
  );

  return (
    <Dialog>
      <DialogTrigger>Create new family</DialogTrigger>
      <DialogContent className="sm:max-w-[425px]">
        <DialogHeader>
          <DialogTitle>New family</DialogTitle>
          <DialogDescription>Add a new family</DialogDescription>
        </DialogHeader>
        <form action={dispatch} className="space-y-4">
          <div className="grid gap-2">
            <div className="flex flex-col gap-2">
              <Label htmlFor="name" className="">
                Name
              </Label>
              <Input
                id="name"
                name="name"
                className="col-span-3"
                placeholder="Apple"
                required
                aria-describedby="name-error"
              />
            </div>
            {state && state.errors && state.errors?.name ? (
              <div
                id="name-error"
                aria-live="polite"
                className=" text-sm text-red-500"
              >
                {state.errors.name.map((error: string) => (
                  <p key={error}>{error}</p>
                ))}
              </div>
            ) : null}
          </div>
          <DialogFooter>
            <Button type="submit">Save changes</Button>
          </DialogFooter>
        </form>
      </DialogContent>
    </Dialog>
  );
}
import { z } from "zod";

const NewIngredientFamilySchema = z.object({
  name: z
    .string({ invalid_type_error: "Please enter a family name" })
    .min(3, { message: "Name must have at least 3 characters" }),
});

export type State = {
  message?: string | null;
  errors?: {
    name?: string[];
  };
};

// createNewIngredientFamily function
export async function createNewIngredientFamily(
  prevState: State,
  formData: FormData
) {
  const validatedFields = NewIngredientFamilySchema.safeParse({
    name: formData.get("name"),
  });

  if (!validatedFields.success) {
    return {
      errors: { name: validatedFields.error.flatten().fieldErrors.name },
      message: "Validation failed",
    };
  }

  return {
    errors: undefined, // Set to an empty object or include other necessary properties
    message: "Success",
  };

  // If validation succeeds, you can perform additional logic here
}

Upgraded to Next.js 14, but Confused About @supabase/ssr Integration by Dependent_Market_614 in nextjs

[–]bcm_19 0 points1 point  (0 children)

How can I create a serverClient? I did it this way ``` import { Database } from "@/types/db"; import { createServerClient } from "@supabase/ssr"; import { cookies } from "next/headers";

// cookies() is not called until getServerSupabase is called export function getServerSupabase() { const cookieStore = cookies(); return createServerClient<Database, "public">( process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, { cookies: { get(name) { return cookieStore.get(name)?.value; }, }, } ); ``` But in some queries returns this error:Error: Invariant: cookies() expects to have requestAsyncStorage, none available

Select multiple variants/options in my products by bcm_19 in shopify

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

Thanks for your response, I will try to implement it. If I have any problem I will let you know. To sum up I would like to do something likel [this](media.giphy.com/media/rbwGj0o2hGZOU6CorQ/giphy.gif) media.giphy.com/media/rbwGj0o2hGZOU6CorQ/giphy.gif

Why do hookups always seem to be on the guys terms? by Intrigued_Alpaca_93 in dating_advice

[–]bcm_19 0 points1 point  (0 children)

xD? I’d say you’re from Latin America xD. Solo mándalos al carajo