calling server action from client sido throws webpack error - default webpack config

I'm trying to use a server action and when i run it i get
TypeError: __webpack_modules__[moduleId] is not a function
at Object.__webpack_require__ [as require] (/home/huilensolis/dev/projects/Pictura/.next/server/webpack-runtime.js:33:42)
TypeError: __webpack_modules__[moduleId] is not a function
at Object.__webpack_require__ [as require] (/home/huilensolis/dev/projects/Pictura/.next/server/webpack-runtime.js:33:42)
my component:
"use client";

import { createDefaultProfile } from "@/actions/create-profile";
import { PlainButton } from "@/components/ui/buttons/plain";
import { useSupabase } from "@/hooks/use-supabase";
import { ClientRouting } from "@/models/routing/client";
import { VenetianMask } from "lucide-react";
import { useRouter } from "next/navigation";
import { useState } from "react";

export function SignInAnonymouslyBtn() {
const [loading, setLoading] = useState(false);
const [error, setError] = useState("");

const { supabase } = useSupabase();

const router = useRouter();

async function SignInAnonymously() {
setLoading(true);

try {
const { error } = await supabase.auth.signInAnonymously();
await createDefaultProfile();

router.push(ClientRouting.app);
} catch (error) {
console.log({ error });
}
}

return (
<>
<PlainButton
className="bg-indigo-600 dark:bg-indigo-700 text-neutral-50"
isLoading={loading}
disabled={loading}
onClick={SignInAnonymously}
>
Sign In Anonymously <VenetianMask />
</PlainButton>
{error && <p className="dark:text-red-500">{error}</p>}
</>
);
}
"use client";

import { createDefaultProfile } from "@/actions/create-profile";
import { PlainButton } from "@/components/ui/buttons/plain";
import { useSupabase } from "@/hooks/use-supabase";
import { ClientRouting } from "@/models/routing/client";
import { VenetianMask } from "lucide-react";
import { useRouter } from "next/navigation";
import { useState } from "react";

export function SignInAnonymouslyBtn() {
const [loading, setLoading] = useState(false);
const [error, setError] = useState("");

const { supabase } = useSupabase();

const router = useRouter();

async function SignInAnonymously() {
setLoading(true);

try {
const { error } = await supabase.auth.signInAnonymously();
await createDefaultProfile();

router.push(ClientRouting.app);
} catch (error) {
console.log({ error });
}
}

return (
<>
<PlainButton
className="bg-indigo-600 dark:bg-indigo-700 text-neutral-50"
isLoading={loading}
disabled={loading}
onClick={SignInAnonymously}
>
Sign In Anonymously <VenetianMask />
</PlainButton>
{error && <p className="dark:text-red-500">{error}</p>}
</>
);
}
my server action:
"use server";

export async function createDefaultProfile() {
console.log('hello world')
}
"use server";

export async function createDefaultProfile() {
console.log('hello world')
}
I'm using multiple server actions in my project, and none of them throws this error, they work fine.
16 Replies
Huilen
HuilenOP7mo ago
this is what i get in the client
Neto
Neto7mo ago
iirc you can't call a server action like that they can only be bound to buttons or forms nvm try using via the closure, but it seems to not work calling ouside a onClick or something similar top, got called normally here what version of next are you using?
Huilen
HuilenOP7mo ago
14.0.3
Huilen
HuilenOP7mo ago
GitHub
Pictura/src/app/(site)/app/settings/section/profile/page.tsx at 907...
Social media platform for image sharing. Upload, search, download, and engage with images uploaded by the community. - Huilensolis/Pictura
Neto
Neto7mo ago
try removing the .next folder and node_modules
Huilen
HuilenOP7mo ago
and im calling it from a client function
Neto
Neto7mo ago
maybe its a compilation issue
Huilen
HuilenOP7mo ago
let me try that sure it is tried it, same errors
Neto
Neto7mo ago
its a full nextjs issue
Neto
Neto7mo ago
GitHub
TypeError: webpack_modules[moduleId] is not a function · vercel...
Running a Next api route will surface the following error: TypeError: webpack_modules[moduleId] is not a function at webpack_require (/Users/noah/Dev/BeeBeeLearn/.next/server/webpack-runtim...
Neto
Neto7mo ago
it's not a new issue
Huilen
HuilenOP7mo ago
GitHub
[NextJS 14.1.0] TypeError: Cannot read properties of undefined (rea...
Link to the code that reproduces this issue https://github.com/dashawk/nextjs-14-bugger To Reproduce Clone the provided repository Run yarn install && yarn dev Browse to http://localhost:30...
Huilen
HuilenOP7mo ago
well, i guess next js is broken since feb 13 and they dont plan on fixing it any soon
Neto
Neto7mo ago
lmao yeah
Huilen
HuilenOP7mo ago
ty anyways @nyx (Rustular DevRel)
Neto
Neto7mo ago
sorry for not fixing it hopefully next fixes it soon enough
Want results from more Discord servers?
Add your server