Skip to content

error Error [TypeError]: request.formData is not a function #53827

Answered by loganknecht
loganknecht asked this question in Help
Discussion options

You must be logged in to vote

Ok... So this is a huge headache.

For anyone who finds this. The issue was several things.

  1. Next 13 has a different support system for routes which uses route handlers
  2. You cannot use the request.formData without using route handlers
  3. You need to also make sure your route handler is exported correctly
  4. Even with these pieces in place, you still need to disable the body parser

In order to fix this I had to move my api endpoints from the repo_root_dir/src/pages/api/v1/package/submit.tsx directory to repo_root_dir/src/app/api/v1/package/submit/route.ts

THEN

I had to rename my function to POST

AND THEN I had to set …

Replies: 7 comments 7 replies

Comment options

You must be logged in to vote
2 replies
@AidanGuarniere
Comment options

@boris-szl
Comment options

Answer selected by loganknecht
Comment options

You must be logged in to vote
2 replies
@loganknecht
Comment options

@tamvo22
Comment options

Comment options

You must be logged in to vote
2 replies
@zhangxinyong12
Comment options

@loganknecht
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Nazehs
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet