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 timeimport { 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>;
// @ts-expect-error `.open-next/worker.ts` is generated at build timeimport { 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/[email protected]/node_modules/file-type/core.js" for import "fileTypeFromFile" node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/payload/dist/uploads/endpoints/getFile.js:1:9: 1 │ import { fileTypeFromFile } from 'file-type'; ╵ ~~~~~~~~~~~~~~~~ ✘ [ERROR] No matching export in "node_modules/.pnpm/[email protected]/node_modules/file-type/core.js" for import "fileTypeFromFile" node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/payload/dist/uploads/getFileByPath.js:1:9: 1 │ import { fileTypeFromFile } from 'file-type'; ╵ ~~~~~~~~~~~~~~~~
✘ [ERROR] Build failed with 2 errors: ✘ [ERROR] No matching export in "node_modules/.pnpm/[email protected]/node_modules/file-type/core.js" for import "fileTypeFromFile" node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/payload/dist/uploads/endpoints/getFile.js:1:9: 1 │ import { fileTypeFromFile } from 'file-type'; ╵ ~~~~~~~~~~~~~~~~ ✘ [ERROR] No matching export in "node_modules/.pnpm/[email protected]/node_modules/file-type/core.js" for import "fileTypeFromFile" node_modules/.pnpm/[email protected][email protected][email protected]/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?