Nuxt 3 server storage with file system driver not working

Hello,

Is there a way to use Node ‘fs’ driver as stated in the nitro doc on Netlify ?

It works on my local environnement to cache api results with the following in nuxt.config.ts

nitro: {
        storage: {
            'db': {
                driver: 'fs',
                base: './.data/db',
            }
        }
    },

But once pushed to Netlify for the Nuxt endpoints using caching I get

{
  "url": "/api/layout/footer-1",
  "statusCode": 500,
  "statusMessage": "Internal Server Error",
  "message": "ENOENT: no such file or directory, open '/opt/build/repo/.data/db/https/path/to/cache/file...",
  "description": ""
}

Maybe there is a way to allow write access to /opt/build/repo/.data path ?

thanks,
Michael

Hi @m_picard

Is it not possible to write data once a site is deployed. Is that what you are trying to do?

If you are wanting to write data from the site, you would need to use a function to save that data to an external source (e.g. database.)

Hi @coelmay,

Thanks for your reply. I will use the in memory default then.

1 Like