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