ashbuilds / payload-ai

AI Plugin is a powerful extension for the Payload CMS, integrating advanced AI capabilities to enhance content creation and management.
Other
66 stars 10 forks source link

Undefined admin components throws error #44

Closed marvinengelmann closed 1 month ago

marvinengelmann commented 1 month ago

Tried to use your plugin but getting the following repeating error, didn't even get to login. Any Ideas? I tested with payload 108 and 104. And I'm not using any custom admin components.

webpack-internal:///(rsc)/./node_modules/@ai-stack/payloadcms/dist/plugin.js:72
                ...incomingConfig.admin.components.providers ?? [],
                                                   ^

TypeError: Cannot read properties of undefined (reading 'providers')
    at eval (webpack-internal:///(rsc)/./node_modules/@ai-stack/payloadcms/dist/plugin.js:72:52)
    at eval (webpack-internal:///(rsc)/./node_modules/payload/dist/config/build.js:15:20)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async buildConfig (webpack-internal:///(rsc)/./node_modules/payload/dist/config/build.js:13:36)

Node.js v20.17.0
 ⨯ node_modules/@ai-stack/payloadcms/dist/plugin.js (55:1) @ eval
 ⨯ Internal error: TypeError: Cannot read properties of undefined (reading 'providers')
    at eval (./node_modules/@ai-stack/payloadcms/dist/plugin.js:72:52)
    at eval (./node_modules/payload/dist/config/build.js:15:20)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async buildConfig (./node_modules/payload/dist/config/build.js:13:36)
digest: "2664713455"
  53 |             const { collections: collectionSlugs = [] } = pluginConfig;
  54 |             incomingConfig.admin.components.providers = [
> 55 |                 ...incomingConfig.admin.components.providers ?? [],
     | ^
  56 |                 {
  57 |                     clientProps: {},
  58 |                     path: '@ai-stack/payloadcms/client#InstructionsProvider',

package.json:

"dependencies": {
    "@ai-stack/payloadcms": "^3.0.0-beta.104",
    "@arcjet/next": "^1.0.0-alpha.26",
    "@hookform/resolvers": "^3.9.0",
    "@payloadcms/db-postgres": "3.0.0-beta.108",
    "@payloadcms/email-resend": "3.0.0-beta.108",
    "@payloadcms/live-preview-react": "3.0.0-beta.108",
    "@payloadcms/next": "3.0.0-beta.108",
    "@payloadcms/plugin-cloud-storage": "3.0.0-beta.108",
    "@payloadcms/plugin-form-builder": "3.0.0-beta.108",
    "@payloadcms/plugin-seo": "3.0.0-beta.108",
    "@payloadcms/richtext-lexical": "3.0.0-beta.108",
    "@payloadcms/richtext-slate": "3.0.0-beta.108",
    "@payloadcms/storage-vercel-blob": "3.0.0-beta.108",
    "@payloadcms/ui": "3.0.0-beta.108",
    "@phosphor-icons/react": "^2.1.7",
    "@radix-ui/react-accordion": "^1.2.0",
    "@radix-ui/react-aspect-ratio": "^1.1.0",
    "@radix-ui/react-checkbox": "^1.1.1",
    "@radix-ui/react-dialog": "^1.1.1",
    "@radix-ui/react-label": "^2.1.0",
    "@radix-ui/react-navigation-menu": "^1.2.0",
    "@radix-ui/react-select": "^2.1.1",
    "@radix-ui/react-separator": "^1.1.0",
    "@radix-ui/react-slot": "^1.1.0",
    "@radix-ui/react-switch": "^1.1.0",
    "@radix-ui/react-toast": "^1.2.1",
    "@radix-ui/react-tooltip": "^1.1.2",
    "babel-plugin-react-compiler": "0.0.0-experimental-6067d4e-20240924",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.1",
    "cross-env": "^7.0.3",
    "embla-carousel-react": "^8.2.1",
    "html-entities": "^2.5.2",
    "lucide-react": "^0.438.0",
    "next": "15.0.0-canary.165",
    "next-plausible": "^3.12.2",
    "payload": "3.0.0-beta.108",
    "react": "19.0.0-rc-04bd67a4-20240924",
    "react-dom": "19.0.0-rc-04bd67a4-20240924",
    "react-fast-marquee": "^1.6.5",
    "react-hook-form": "^7.53.0",
    "react-type-animation": "^3.2.0",
    "sharp": "0.33.5",
    "tailwind-merge": "^2.5.2",
    "tailwindcss-animate": "^1.0.7",
    "zod": "^3.23.8"
  },
  "devDependencies": {
    "@tailwindcss/typography": "^0.5.15",
    "@types/node": "22.5.3",
    "@types/react": "npm:types-react@19.0.0-rc.0",
    "@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
    "eslint": "^8.57.0",
    "eslint-config-next": "15.0.0-canary.60",
    "postcss": "^8.4.45",
    "prettier": "^3.3.3",
    "prettier-plugin-tailwindcss": "^0.6.6",
    "tailwindcss": "^3.4.10",
    "typescript": "5.5.4"
  },
ashbuilds commented 1 month ago

@marvinengelmann Thanks for reporting the issue. I just released a fix -

https://github.com/ashbuilds/payload-ai/releases/tag/3.0.0-beta.104.2

marvinengelmann commented 1 month ago

It works, thank you!