Payload error for post feature for users in next js app
Unanswered
Dwarf Hotot posted this in #help-forum
Dwarf HototOP
I'm trying to build a feature where users can post to a forum that looks like the images below. Only thing is I constatly get this error: I have tried debugging numerous times. Cant seem to fix it, does anyone have experience with this bug?
Type error The "payload" argument must be of type object. Received null
at POST (src/app/api/forum/route.ts:258:12)
256 | return NextResponse.json(formattedPost);
257 | } catch (error) {
259 |
260 | return NextResponse.json(
I thought it was my node version, then I thought my logic was off but the response i get when i log my response is correct below:
Raw form data entries: [
[ 'title', 'hi' ],
[ 'content', 'hi' ],
[ 'type', 'GENERAL_DISCUSSION' ]
]
Parsed form data: { title: 'hi', content: 'hi', type: 'GENERAL_DISCUSSION' }
Number of files: 0
Creating post with data: {
title: 'hi',
content: 'hi',
type: 'GENERAL_DISCUSSION',
userId: 'theuseridiblockedout'
}
Type error The "payload" argument must be of type object. Received null
at POST (src/app/api/forum/route.ts:258:12)
256 | return NextResponse.json(formattedPost);
257 | } catch (error) {
258 | console.error('Error creating post:', error);| ^
259 |
260 | return NextResponse.json(
I thought it was my node version, then I thought my logic was off but the response i get when i log my response is correct below:
Raw form data entries: [
[ 'title', 'hi' ],
[ 'content', 'hi' ],
[ 'type', 'GENERAL_DISCUSSION' ]
]
Parsed form data: { title: 'hi', content: 'hi', type: 'GENERAL_DISCUSSION' }
Number of files: 0
Creating post with data: {
title: 'hi',
content: 'hi',
type: 'GENERAL_DISCUSSION',
userId: 'theuseridiblockedout'
}