Next.js Discord

Discord Forum

Module not found Server action

Unanswered
Sphynx posted this in #help-forum
Open in Discord
SphynxOP
Hi, I'm getting an error when I import a function from a server component I define with the 'use server', I'm not sure why.
The component i'm importing the server function in is a component, itself imported in a page component.
Error:
- error ./node_modules/next/dist/build/webpack/loaders/next-flight-loader/action-client-wrapper.js:21:37
Module not found: Can't resolve 'react-server-dom-webpack/client.edge'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./pages/components/server-util.tsx
./pages/components/form-device.tsx
./pages/devices.tsx


import { addDevice } from "./server-util";
//.....
export default function DeviceForm({ users }: { users: User[] }) {
    const [deviceType, setDeviceType] = useState("");
    const [selectedUser, setSelectedUser] = useState("");
    return (
        <div>
           //....
                 <Button
                 className="ml-10"
                 style={{
                   backgroundColor: "RGB(73, 197, 105)"
                 }}
                 onClick={() => {
                    addDevice({email: selectedUser, device_type: deviceType});
                 }}
               >Send to server</Button>
           
        </div>

    );
};

1 Reply

European sprat
I don't think server actions are supported in pages directory