#e._formData.get is not a function but i have no form

12 messages ยท Page 1 of 1 (latest)

void trout
#

i got the error: e._formData.get is not a function but i have no form

i import a function from a server component to a client component

export async function setupWebhook() {
  console.log("๐Ÿš€ ~ setupWebhook ~ configureLemonSqueezy:");
}

client component:

...
"use client";

import { Button, Loading } from "@lemonsqueezy/wedges";
import { CheckIcon, WebhookIcon } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
import { setupWebhook } from "@/app/actions";

export function SetupWebhookButton({
  disabled = false,
}: {
  disabled?: boolean;
}) {
  const [loading, setLoading] = useState(false);
  const [activated, setActivated] = useState(false);

  const beforeElement = loading ? (
    <Loading size="sm" className="size-4" />
  ) : (
    <WebhookIcon className="size-4" />
  );

  return (
    <Button
      disabled={disabled || loading || activated}
      before={
        !activated && !disabled ? (
          beforeElement
        ) : (
          <CheckIcon className="size-4" />
        )
      }
      onClick={async () => {
        setLoading(true);
        try {
          await setupWebhook();
          toast.success("Webhook set up successfully.");
        } catch (error) {
          // eslint-disable-next-line no-console -- allow
          console.error(error);
          toast("Error setting up a webhook.", {
            description:
              "Please check the server console for more information.",
          });
        } finally {
          setActivated(true);
          setLoading(false);
        }
      }}
    >
      Setup Webhook
    </Button>
  );
}

mild portalBOT
#

๐Ÿ”Ž This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

๐Ÿ•ต๏ธ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

โœ… You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

covert token
#

its a known error when you try to call from server to client.
should work if you try to call:

try {
await setupWebhook();
toast.success("Webhook set up successfully.");
in UseEffect

void trout
covert token
#

this is server side right?

export async function setupWebhook() {
console.log("๐Ÿš€ ~ setupWebhook ~ configureLemonSqueezy:");
}

#

I had a similar issue with appwrite. They said it got fixed in 1.5.1 but i havent tested it out

#

im doing everything from client

void trout
#

yep in fact i've tested create a file server side without any import and imported in my client file and got this error

void trout