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

cloud-storage error

3 weeks ago

Getting the following error after installing and configuring



ERROR in ./node_modules/@payloadcms/plugin-cloud-storage/dist/adapters/s3/handleUpload.js 43:27-40
Module not found: Error: Can't resolve 'fs' in '/usr/src/app/node_modules/@payloadcms/plugin-cloud-storage/dist/adapters/s3'

I saw in another community post that maybe I need to setup an alias to


in the webpack config. The README for this plugin doesn't state that however. I'm going to give it a go but if that's unintended, I'd like to know.


Adding the alias seems to have worked, though I think (if possible) it'd be better if the package could avoid requiring


if it's being compiled client side.

Here's what I did in case someone searches in here to find an answer and missed it on the website:


export default {}


import path from 'path'
const mockModulePath = path.resolve(__dirname, 'mocks/emptyObject.js')

export default buildConfig({
    serverURL: 'http://localhost:3000',
    admin: {
        webpack: (config) => {
            return {
                resolve: {
                    alias: {
                        'fs': mockModulePath,

Then it compiled just fine. I also had to add a


property to the s3 config. That wasn't immediately called out in the readme.

Hope this is helpful to someone!

    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