Hello
Im testing payload, when I try to upload an image, I get an error on the console I see the following:
[19:57:15] ERROR (payload): Error: EROFS: read-only file system, mkdir '/product_files'
File for this collection
const purchasedProductFilesIds = orders.map((order) => {
return order.products
.map((product) => {
if (typeof product === "string")
return req.payload.logger.error("Search depth not sufficient");
return typeof product.product_files === "string"
? product.product_files
: product.product_files.id;
})
.filter(Boolean)
.flat();
});
return {
id: {
in: [...ownProductsFilesIds, ...purchasedProductFilesIds],
},
};
};
export const ProductFiles: CollectionConfig = {
slug: "product_files",
admin: {
hidden: ({ user }) => user?.role !== "admin",
},
hooks: {
beforeChange: [addUser],
},
access: {
read: yourOwnPurchased,
update: ({ req }) => req.user?.role === "admin",
delete: ({ req }) => req.user?.role === "admin",
},
upload: {
staticURL: "/product_files",
staticDir: "/product_files",
mimeTypes: ["image/*", "font/*", "application/postcript"],
},
fields: [
{
name: "user",
type: "relationship",
relationTo: "users",
admin: {
condition: () => false,
},
required: true,
hasMany: false,
},
],
};
ok the workaround now its to launch the server as sudo user in linux, how would be the proper way to launch it ?
on Mac I still get the error
ok managed to find the issue I mistakenly added to the staticURL an /
Hi guys,
I’m getting error there was a problem while uploading a file
Any solve for this error
Star
Discord
online
Get dedicated engineering support directly from the Payload team.