Error: e._formData.get is not a function
Answered
Munchkin posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
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
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
34 Replies
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
does the error occur on page load or other event?
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
MunchkinOP
Whenever I call that i want to get access to the database. Which in this case is on page load.
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
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](https://cdn.discordapp.com/embed/avatars/5.png)
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](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
doesn't seem like it, you are using server action there
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
MunchkinOP
If i try to call that same function from SSR to SSR it does work
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
oh ok I may know what happen
try pass the action to the client component like this
<BottomContainer action={GetServerSpells} />
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
MunchkinOP
ok ill try
Where would i have to do that. BottomContainer is the client component. Database.jsx is my server component.
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
do it where you render
BottomContainer
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
MunchkinOP
then it tells me the function is not defined
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
did you import it?
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
MunchkinOP
If i import it, it gives me the same error again
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
are you rendering
BottomContainer
in a client component![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
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://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
https://appwrite.io/docs/quick-starts/nextjs
according to their doc, the appwrite client works on client side?
according to their doc, the appwrite client works on client side?
ok
Yes but i am using node-appwrite
which is server side
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
ah ok
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
MunchkinOP
if i try client side it tells me i dont have authorization. which seemed like a bigger headache
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
ok try add this to
next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
serverComponentsExternalPackages: ['node-appwrite'],
},
}
module.exports = nextConfig
Answer
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
MunchkinOP
I dont get the error anymore
let me check if i can read out the DB
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
ok
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
MunchkinOP
Yeah that seemed to have worked perfectly!
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
cool
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
MunchkinOP
Thank you so very much!
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
np