Cannot destructure property 'data' of 'parseBody(...)' as it is undefined. Authneticated Post Request

System Information
  • Strapi Version:4.3.4
  • Operating System: WIndows
  • Database: sqlite
  • Node Version: 16.17.0
  • NPM Version: 8.14.0
  • Yarn Version:

Im trying to make an authenticated post request like so

const formData = createFormData(formValues);

      console.log(formData);
      const response = await axios.post(
        `${process.env.NEXT_PUBLIC_SERVER_URL}/api/podcasts`,
        formData,
        {
          headers: {
            Authorization: `Bearer ${auth.jwt}`,
            'Content-Type': 'multipart/form-data',
          },
        },
      );


But i end up getting ‘Cannot destructure property ‘data’ of ‘parseBody(…)’ as it is undefined.’ I totally unsure of what is happening. Help would be apreciated

Not to sure but doesn’t the formData need to be stringified when sending it ?

I’ve just had the same error message and I solved it by changing the content type to ‘application/json’. Maybe your form Data isn’t formatted correctly?
I do have to change the content type between sending forms (=> multipart) and regular requests (=> json).