
This error occurs when attempting to use server actions in NextJS with appwrite.
First of all, all credit goes to @antho1404 (on Github). He identified that the issue is related to an import of the isomoprhic-form-data library overriding the FormData with an invalid object and further determined that it only happens when the library is imported rather than loaded over a cdn for example. The solution he came up with is to override the library with a dummy file.
One solution to fix this is to "override" this library with Webpack.
import weback from 'webpack'
const nextConfig = {
webpack(config) {
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(
/^isomorphic-form-data$/,
${config.context}/form-data-mock.js
)
);
return config;
},
};
Then, create a form-data-mock.js in the root and the error goes away.
My question is: instead of this hacky approach, is there a way to fix this import in future versions, so that the community can take full advantage of server actions? With this error, server actions in NextJS are completely unuseable. All credit and enormous gratitude again to @antho1404 for diving into this.
Recommended threads
- Sharing cookies
Hi, I’m using Appwrite Cloud, and I have a setup where my Appwrite backend is hosted on a subdomain (e.g., api.example.com), while my frontend (Next.js app) and...
- Custom Domain Issue
i have added a custom domain about 21 hours ago, but till now there is no SSL certificate is active on it. but if i do DNS check via https://dnschecker.org/#C...
- Flutter OAuth2 Google does not return to...
When the flow starts, the browser opens, I select an account, and it keeps showing: """ Page not found The page you're looking for doesn't exist. `general_rout...
