payload cloud plugin error on building with payload cloud

default discord avatar
sephi_cs
last week

Hi !



When adding payload cloud plugin to my config,


payloadcloud cannot build properly with the following error :



export default buildConfig({
  plugins: [payloadCloud()],
  admin: {
    bundler: webpackBundler(),
  },
  serverURL: "https://backend.moncompagnonderoute.fr",
  editor: slateEditor({}),
  localization: {
    locales: ["fr"],
    defaultLocale: "fr",
  },
  collections: [Users, Structures, Media],
  db: mongooseAdapter({
    url: process.env.MONGODB_URI,
  }),
});


{
  "name": "name",
  "description": "Payload project",
  "version": "1.0.0",
  "main": "dist/server.js",
  "license": "MIT",
  "scripts": {
    "dev": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts nodemon",
    "build:payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload build",
    "build:server": "tsc",
    "build": "yarn copyfiles && yarn build:payload && yarn build:server",
    "serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js",
    "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png}\" dist/",
    "generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:types",
    "generate:graphQLSchema": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:graphQLSchema"
  },
  "dependencies": {
    "@payloadcms/bundler-webpack": "^1.0.5",
    "@payloadcms/db-mongodb": "^1.0.3",
    "@payloadcms/plugin-cloud": "^2.2.6",
    "@payloadcms/richtext-slate": "^1.1.0",
    "@swc/core": "^1.3.96",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "payload": "^2.1.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@types/express": "^4.17.9",
    "copyfiles": "^2.4.0",
    "cross-env": "^7.0.3",
    "nodemon": "^2.0.6",
    "ts-node": "^9.1.1",
    "typescript": "^4.8.4"
  }
}


I cannot find a way to make it works...



So I have 404 when retrieving my media from my external frontend



To give more context, this is to use File storage.



More info so far :


- Even when I delete the content of plugins and import from the config, I still have the error when the depedence is present in the package.json





The error comes from the lib copyfiles afaik



I replaced copyfiles with cpx and now it works fine.



/solve

    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!

    Star

    Connect with the Payload Community on Discord

    Discord

    online

    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.