Next.js Discord

Discord Forum

The "use server" directive must be at the top of the file.

Unanswered
Gharial posted this in #help-forum
Open in Discord
GharialOP
that pisses me off

I am currently using server action inside the server component. I am not dumb and I did not put 'use server' inside the page or something else.

'use server'

import useFetch from '@shared/hooks/useFetch'
// the useFetch hook should be the problem, when I do not use it, it works normally, but it's just a function to handle fetches using axios interceptors, it uses import 'server-only', also I do use this hook from the other server actions and it works perfectly like WTH IS GOING ON, HELP
import { cookies } from 'next/headers'
import { z } from 'zod'
import { AxiosError } from 'axios'

export async function AISAuthorize(formData: FormData) {
    // some code to make a request to the backend and make come changes
}

0 Replies