Next.js Discord

Discord Forum

Error: e._formData.get is not a function

Answered
Munchkin posted this in #help-forum
Open in Discord
Avatar
MunchkinOP
I seem to be running into this issue when i try to get my database data.

Using this code:

client script: https://hastebin.com/share/nufebidini.javascript
Server script: https://hastebin.com/share/cipivijavu.javascript
Stack error: https://hastebin.com/share/icedafidih.less
Answered by Ray
ok try add this to next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    serverComponentsExternalPackages: ['node-appwrite'],
  },
}
 
module.exports = nextConfig
View full answer

34 Replies

Avatar
does the error occur on page load or other event?
Avatar
MunchkinOP
Whenever I call that i want to get access to the database. Which in this case is on page load.
Avatar
try comment out this and return an empty array to see if you get the error
//const x = await DB.listDocuments(
//    process.env.NEXT_PUBLIC_DATABASE_ID,
//    process.env.NEXT_PUBLIC_COLLECTION_SPELL_ID,
//    queryOptions
//  );
//return x;
return []
Avatar
MunchkinOP
I do still get that issue
Could it be that i am trying to reach that database script which is server side on a script that is client side?
Avatar
doesn't seem like it, you are using server action there
Avatar
MunchkinOP
If i try to call that same function from SSR to SSR it does work
Avatar
oh ok I may know what happen
try pass the action to the client component like this
<BottomContainer action={GetServerSpells} />
Avatar
MunchkinOP
ok ill try
Where would i have to do that. BottomContainer is the client component. Database.jsx is my server component.
Avatar
do it where you render BottomContainer
Avatar
MunchkinOP
then it tells me the function is not defined
Avatar
did you import it?
Avatar
MunchkinOP
If i import it, it gives me the same error again
Avatar
are you rendering BottomContainer in a client component
Avatar
MunchkinOP
no im not
BottomContainer is on my page.js
If you want, I have the whole project public. So you can take a look at it from there
Avatar
https://appwrite.io/docs/quick-starts/nextjs
according to their doc, the appwrite client works on client side?
ok
Avatar
MunchkinOP
Yes but i am using node-appwrite
which is server side
Avatar
ah ok
Avatar
MunchkinOP
if i try client side it tells me i dont have authorization. which seemed like a bigger headache
Avatar
ok try add this to next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    serverComponentsExternalPackages: ['node-appwrite'],
  },
}
 
module.exports = nextConfig
Answer
Avatar
MunchkinOP
I dont get the error anymore
let me check if i can read out the DB
Avatar
ok
Avatar
MunchkinOP
Yeah that seemed to have worked perfectly!
Avatar
cool
Avatar
MunchkinOP
Thank you so very much!
Avatar
np