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
- Unable to find repos with my connected G...
I've been playing with Appwrite for a few weeks and became a paid user a few days ago (if this makes a difference for features). I've created a function and a...
- Upgrade message on Pro plan in Cloud
Why do I have this error that says `You've reached the limit for the Pro plan. Upgrade your organization for additional resources.` even though I am on the Pro ...
- Appwrite 1.6.0 Self Hosted with Web-Clie...
I am not able to receive realtime responses from the backend. I think its caused by the "unanswered" ping? Any suggestions? 😄