When trying to setup a payload project that makes use of s3 I get this unexplainable error, and I'm wondering if there's anyone who has successfully used the official payload cloud storage plugin
To be clear, I want to store media files locally while I'm developing and on s3 when in Production
I ran into this recently. there's kind of an odd work-around atm
setup a folder called "mocks" and put a
emptyObject.js
in it with this as its contents :
export default {}
then add this to your payload.config.ts under the
admin
property
webpack: (config) => {
return {
...config,
resolve: {
...config.resolve,
alias: {
...config.resolve.alias,
'fs': mockModulePath,
}
}
};
},
from what I understand, the issue arises because part of the build process assumes being on the browser, and
fs
doesn't exist there. so this alias allows it to get around that
Alright I'll try this, thanks!
It works!
Thank you!
NOTE FOR THOSE USING PNPM: make sure to
pnpm i -D process
to avoid errors
Hey @Jakey , thanks for helping out! I just ran into the same problem, but I'm not able to fix it unfortunately. What does the mockModulePath refer to? Is it the imported empty object or the path as a string?
empty object
Hmm I get an 'Invalid Configuration Object' Error when I do that. I have no idea about webpack so I'm pretty lost here😅
Has someone already gone ahead and opened up an issue? That workaround feels weird
Agreed, I haven't updated my payload cms lately, so i wonder if it's a new error. I'll post here if it comes up when I do.