Error “You have to implement action component for your Action” while implementing custom action in adminJS

I am trying to add custom component for an action in adminJS. I only have the basic setup of the project. I am new to adminJS, so any help is appreciated. Thanks.

Below is my code. I only have server.js file and a custom component.

server.js file

process.env.ADMIN_JS_SKIP_BUNDLE = 'false';
process.env.NODE_ENV = 'production';  // Set this based on your environment


import express from 'express';
import AdminJS from 'adminjs';
import AdminJSExpress from '@adminjs/express';
import { Sequelize } from 'sequelize';
import { Database, Resource } from '@adminjs/sequelize';
import { bundle } from '@adminjs/bundler';
import path from 'path';
import { fileURLToPath } from 'url'; // Corrected import for fileURLToPath
import { dirname } from 'path';
import { ComponentLoader } from 'adminjs'

// Convert file URL to path for ES Module compatibility
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const app = express();
const port = 3000;
const sequelize = new Sequelize('sqlite::memory:', { logging: false });

// Define models
const User = sequelize.define('user', {
    email: Sequelize.STRING,
    password: Sequelize.STRING,
});

// Synchronize all models
await sequelize.sync();



// Setup component bundling
const componentsBundlePath = path.join(__dirname, 'public', 'admin-components', 'components.bundle.js');

console.log("Directory:", __dirname);
console.log("Component Path:", path.join(__dirname, 'components', 'CustomEdit.jsx'));
console.log("Bundle Path:", componentsBundlePath);
const componentLoader = new ComponentLoader();
componentLoader.add('CustomEdit', path.join(__dirname, 'components', 'CustomEdit.jsx'));
await bundle({
    destinationDir: 'public/admin-components', // Relative path may not be ideal here
    componentLoader
});

AdminJS.registerAdapter({ Database, Resource });
const admin = new AdminJS({
    databases: [sequelize],
    rootPath: '/admin',
    /*assets: {
        scripts: ['/admin-components/components.bundle.js'],
    },*/
    componentLoader,
    resources: [{
        resource: User,
        options: {
            actions: {
                edit: {
                  //component: EDITCOMPONENT,
                  component: componentLoader.getComponents('CustomEdit'),
                },
            },
        },
    }],
});

const router = AdminJSExpress.buildRouter(admin);

app.use(admin.options.rootPath, router);
app.use(express.static(path.join(__dirname, 'public')));

app.listen(port, () => console.log(`Server started at http://localhost:${port}${admin.options.rootPath}`));

Basic CustomEdit.jsx file

import React from "react"
import { Box, H3 } from "@adminjs/design-system"

const CustomEdit = props => {
  const { record } = props

  return (
    <Box flex>
      <Box
        variant="white"
        width={1 / 2}
        boxShadow="card"
        mr="xxl"
        flexShrink={0}
      >
        <H3>Example of a simple page</H3>
        <p>Where you can put almost everything</p>
        <p>like this:</p>
        <p>
          <img
            src="https://i.redd.it/rd39yuiy9ns21.jpg"
            alt="stupid cat"
            width={300}
          />
        </p>
      </Box>
      <Box>
        <p>Or (more likely), operate on a returned record:</p>
        <Box overflowX="auto">{JSON.stringify(record)}</Box>
      </Box>
    </Box>
  )
}

export default CustomEdit

package.json

{
  "name": "my-adminjs-app",
  "version": "1.0.0",
  "type": "module",
  "scripts": {
    "start": "node server.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@adminjs/bundler": "^3.0.0",
    "@adminjs/express": "^6.1.0",
    "@adminjs/sequelize": "^4.1.1",
    "adminjs": "^7.8.1",
    "express": "^4.19.2",
    "sequelize": "^6.37.3",
    "sqlite3": "^5.1.7"
  }
}

I have looked on several similar issues and tried the workaround but not able to resolve the issue.

When I run the server, the bundling is completed, and it successfully creates components in public/admin-components folder.

New contributor

user24744215 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

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