Currently, it is not possible to read or write files from the file system in Edge Functions. We are evaluating the use cases for potential solutions and are working on making this functionality available in one or another form.
If there is a specific use case that you are thinking of or you have a feature request around this topic, please let us know!
If you landed here because you received this error locally when using the Netlify CLI in a next.js project, please update the CLI and the npm package @netlify/plugin-nextjs to the latest versions.
We’ve got error when we try to run netlify dev in local machine.
Our use case is
Use Nextjs with middleware feature
Run netlify dev and we’ve got this error.
I’m assume that when we run netlify dev it call some script from netlify.app then script try to read/write files from my local, Am I correct ?
Could you help for this issue ?
Hi @hubagaspar91 and @chonlatit.tpit , I’ve tried reproducing this error using a new Next.js app with a middleware.ts file, and my site worked as expected locally using netlify dev. Is it possible for you to share a minimal reproduction case where you see this error?
Also, if possible, can you share more about the error that you’re getting? Logs (if they don’t contain any private information) are very helpful in debugging these types of issues.
Hi @ivaaan , we are experiencing the similar issue w/ same use case as mentioned by @hubagaspar91 when we upgraded to 13.1.1. When running on local dev machine we get this error. We do not have any serverless functions that attempt to read or write to the local file system. We downgraded our CLI to get it working again for now. I’ve uploaded a screenshot of the the traced section in netlify middleware file on the local machine in the exception trace and included the error output from the build log if that helps.
◈ Loaded edge function netlify dev handler
event - compiled client and server successfully in 981 ms (253 modules)
[next-dev] Error: Reading or writing files with Edge Functions is not supported yet. Visit https://ntl.fyi/edge-functions-filesystem to learn more and tell us about your use cases for file system access.
at Object.errorCallback (https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/deno-fs.ts:4:9)
at exists (file:///Users/******/Documents/GitHub/******//.netlify/edge-functions/next-dev/index.js:25:16)
at handler (file:///Users/******/Documents/GitHub/******//.netlify/edge-functions/next-dev/index.js:48:13)
at https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/function_chain.ts:381:15
at https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/util/named_wrapper.ts:19:24
at nf_req_01GV4V9D1BAQE02EMM135SP8WZ (https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/util/named_wrapper.ts:12:68)
at callWithNamedWrapper (https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/util/named_wrapper.ts:19:10)
at FunctionChain.runFunction (https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/function_chain.ts:379:28)
at FunctionChain.run (https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/function_chain.ts:296:31)
at handleRequest (https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/handler.ts:73:34)
[next-dev] Error: Reading or writing files with Edge Functions is not supported yet. Visit https://ntl.fyi/edge-functions-filesystem to learn more and tell us about your use cases for file system access.
at Object.errorCallback (https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/deno-fs.ts:4:9)
at exists (file:///Users/******/Documents/GitHub/******//.netlify/edge-functions/next-dev/index.js:25:16)
at handler (file:///Users/******/Documents/GitHub/******//.netlify/edge-functions/next-dev/index.js:48:13)
at https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/function_chain.ts:381:15
at https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/util/named_wrapper.ts:19:24
at nf_req_01GV4V9D2HW7MBFYVTX5C2A6T2 (https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/util/named_wrapper.ts:12:68)
at callWithNamedWrapper (https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/util/named_wrapper.ts:19:10)
at FunctionChain.runFunction (https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/function_chain.ts:379:28)
at FunctionChain.run (https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/function_chain.ts:296:31)
at handleRequest (https://64071f3033a1800007cc20f8--edge.netlify.app/bootstrap/handler.ts:73:34)
wait - compiling...
event - compiled client and server successfully in 138 ms (253 modules)
Hi @okey , thank you for the extra info! We’ve released the version 13.1.2 of the netlify-cli to fix this regression. If you still see it happening, please let us know in this thread!