e._formData.get is not a function but i have no form
Unanswered
Red ant posted this in #help-forum
Red antOP
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
client component:
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>
);
}11 Replies
Munchkin
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
should work if you try to call:
try {
await setupWebhook();
toast.success("Webhook set up successfully.");
in UseEffect
Munchkin
this is server side right?
export async function setupWebhook() {
console.log("🚀 ~ setupWebhook ~ configureLemonSqueezy:");
}
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
Red antOP
yep in fact i've tested create a file server side without any import and imported in my client file and got this error
@Munchkin I had a similar issue with appwrite. They said it got fixed in 1.5.1 but i havent tested it out
Red antOP
okkay i will see thanks
@Munchkin this is server side right?
export async function setupWebhook() {
console.log("🚀 ~ setupWebhook ~ configureLemonSqueezy:");
}
Red antOP
alright so its because i used appwrite than node-appwrite
Munchkin
well that is under the assumption you use appwrite.
but yeah i'd recommend using appwrite instead of node-appwrite
but yeah i'd recommend using appwrite instead of node-appwrite