payloadcms not working with cloudflare queue

Hi, I'm trying to run jobs.run() in worker queue. But I'm getting some build errors.

// @ts-expect-error `.open-next/worker.ts` is generated at build time
import { default as handler } from "../.open-next/worker";

import config from "@payload-config";
import { getPayload } from "payload";

export default {
  fetch: handler.fetch,
  async queue() {
    console.log("Running jobs...");
    const payload = await getPayload({ config });
    await payload.jobs.run();
  },
  async scheduled() {},
} satisfies ExportedHandler<CloudflareEnv>;


So when I try to deploy it, I get
✘ [ERROR] Build failed with 2 errors:

  ✘ [ERROR] No matching export in
  "node_modules/.pnpm/file-type@19.3.0/node_modules/file-type/core.js" for import
  "fileTypeFromFile"
  
  
  node_modules/.pnpm/payload@3.67.0_graphql@16.12.0_typescript@5.9.3/node_modules/payload/dist/uploads/endpoints/getFile.js:1:9:
        1 │ import { fileTypeFromFile } from 'file-type';
          ╵          ~~~~~~~~~~~~~~~~
  
  
  ✘ [ERROR] No matching export in
  "node_modules/.pnpm/file-type@19.3.0/node_modules/file-type/core.js" for import
  "fileTypeFromFile"
  
  
  node_modules/.pnpm/payload@3.67.0_graphql@16.12.0_typescript@5.9.3/node_modules/payload/dist/uploads/getFileByPath.js:1:9:
        1 │ import { fileTypeFromFile } from 'file-type';
          ╵          ~~~~~~~~~~~~~~~~



I'm not using graphql in the project. When I remove the queue code, it finish the build without any issue, Anyone have any idea how to use the payload jobs in worker queue?

Packages:
"payload": "^3.67.0",
"wrangler": "^4.53.0",
"graphql": "^16.12.0",
"@opennextjs/cloudflare": "^1.14.2",
"next": "15.5.7",


Thanks
Was this page helpful?