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
- Need help with createExecution function
Hi, Need some help understanding createExecution. When requesting function execution via createExecution, the function handler arguments are incorrect and rese...
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Need Help with Google OAuth2 in Expo usi...
I'm learning React Native with Expo and trying to set up Google OAuth2 with Appwrite. I couldn't find any good docs or tutorials for this and my own attempt did...