Nextjs 14 server action do not work while using server-only

I am trying to use server action in my current project. Some do work other will complete fail to compile. While it seems to work perfectly fine for others, the exact same code will not execute in my project.

import 'server-only';
const BUNNY_STORAGE_API_HOST = 'storage.bunnycdn.com';

export const uploadFile = async (path: string, file: Buffer) => {
  const uploadFileUrl = new URL(`/${process.env.BUNNYCDN_STORAGE_ZONE}/${path}`, `https://${BUNNY_STORAGE_API_HOST}`);

  await fetch(uploadFileUrl, {
    method: 'PUT',
    headers: {
      AccessKey: process.env.BUNNYCDN_API_KEY || '',
      'Content-Type': 'application/octet-stream',
    },
    body: file,
  });
};

This is then imported into a server action:

'use server';
import 'server-only';
import { uploadFile } from './storage';
import sharp from 'sharp';
import { nanoid } from 'nanoid';
import { parseAsync } from 'valibot';
import { UploadImageSchema } from './schema/upload-image.schema';

export const uploadImageAction = async (formData: FormData) => {
  const formDataObject = Object.fromEntries(formData.entries());

  const data = await parseAsync(UploadImageSchema, formDataObject);

  const imageArrayBuffer = await data.image.arrayBuffer();
  const processedFile = await sharp(imageArrayBuffer).webp().toBuffer();

  const path = `images/${nanoid()}.webp`;
  await uploadFile(path, processedFile);

  const imageUrl = new URL(path, `https://${process.env.BUNNYCDN_CDN_HOST}/`);
};

and then being called from a client component as per documentation:

'use client';

import { CloudUploadIcon } from 'lucide-react';

import { useForm } from 'react-hook-form';
import {
  Button,
  Form,
  FormControl,
  FormDescription,
  FormField,
  FormItem,
  FormLabel,
  Input,
} from '@rocket-house-productions/shadcn-ui';

import { uploadImageAction } from '@rocket-house-productions/actions/server';

interface FileUploadProps {
  onChange: (url?: string) => void;
  endpoint: any; //keyof typeof ourFileRouter;
}

type FormValues = {
  image?: File;
};

export const FileUpload = ({ onChange, endpoint }: FileUploadProps) => {
  const form = useForm<FormValues>();

  async function onSubmit(values: FormValues) {
    const formData = new FormData();
    formData.append('image', values.image!);

    await uploadImageAction(formData);
  }

  // @ts-ignore
  return (
    <Form {...form}>
      <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
        <FormField
          control={form.control}
          name="image"
          render={({ field }) => (
            <FormItem>
              <FormLabel>Image</FormLabel>
              <FormControl>
                <Input
                  {...field}
                  required
                  type="file"
                  onChange={event => {
                    field.onChange(event.target.files?.[0]);
                  }}
                  // @ts-ignore
                  value={field.value?.fileName}
                  accept="image/png, image/jpeg, image/webp"
                />
              </FormControl>
              <FormDescription>Select image to upload</FormDescription>
            </FormItem>
          )}
        />

        <Button disabled={form.formState.isSubmitting} type="submit">
          Upload
        </Button>
      </form>
    </Form>
  );
};

But all I am getting this the following error.

hydration-error-info.js:63 ../../libs/shared/actions/src/storage.ts
Error: 
  × You're importing a component that needs server-only. That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/getting-started/
  │ react-essentials#server-components
  │ 
  │ 
   ╭─[/Users/olafsiebert/html/rocket_house_productions/libs/shared/actions/src/storage.ts:1:1]
 1 │ import 'server-only';
   · ─────────────────────
 2 │ const BUNNY_STORAGE_API_HOST = 'storage.bunnycdn.com';
 3 │ 
 4 │ export const uploadFile = async (path: string, file: Buffer) => {
   ╰────

Import trace for requested module:
../../libs/shared/actions/src/storage.ts
../../libs/shared/actions/src/server.ts
../../libs/shared/features/src/lib/file-upload/file-upload.tsx

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật