Like what we’re doing? Star us on GitHub!

Error when trying to use the cloud storage plugin: Can't resolve "fs"
3 weeks ago

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

  • Jakey
    3 weeks ago

    I ran into this recently. there's kind of an odd work-around atm

    setup a folder called "mocks" and put a


    in it with this as its contents :

    export default {}

    then add this to your payload.config.ts under the



    webpack: (config) => {
                return {
                    resolve: {
                        alias: {
                            'fs': mockModulePath,

    from what I understand, the issue arises because part of the build process assumes being on the browser, and


    doesn't exist there. so this alias allows it to get around that

    3 weeks ago

    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

  • Sandro Wegmann
    last week

    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?

  • Jakey
    last week

    empty object

  • Sandro Wegmann
    last week

    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

  • Jakey
    last week

    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.

Open the post
Continue the discussion in Discord
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More