Email lead form submissions fail in the Corporate Starter Template because the JSON data sent to http://localhost:1337/api/lead-form-submissions isn't wrapped in { data: { <payload> }}, leading to 400 BAD REQUEST errors.
At first I couldn't replicate this behavior with Postman either. Turns out Strapi expects its POSTDATA in a very peculiar way (at least peculiar to me 😂).
Email lead form submissions fail in the Corporate Starter Template because the JSON data sent to
http://localhost:1337/api/lead-form-submissions
isn't wrapped in{ data: { <payload> }}
, leading to400 BAD REQUEST
errors.Buggy code:
Fixed code:
At first I couldn't replicate this behavior with Postman either. Turns out Strapi expects its POSTDATA in a very peculiar way (at least peculiar to me 😂).
Mad props to Arsiki at https://stackoverflow.com/questions/71187083/problem-with-post-action-on-strapi-via-postman for figuring out how to send POSTDATA to Strapi via Postman. (I am sure the proper way is documented somewhere also.)
After that, it became clear that the
data
field was missing in the JSON submitted back home via the lead form.