Unable to read POST form data in nodejs from HTML

Hi there…I need some help badly. I have a static website based on html and plain javascript. I need to add some backend functionality so I have moved my project to glitch. Created a Fastify server app and integrated the url’s which is working fine.
I have a form submission in checkout page html upon success will land in confirmation html. My node js api is not able to read the request.body. I have implemented the middleware function also. Below is the snippet from server.js, Any help is appreciated.

fastify.register(require(‘fastify-raw-body’), {
field: ‘rawBody’, // change the default request.rawBody property name
global: false, // add the rawBody to every request. Default true
encoding: ‘utf8’, // set it to false to set rawBody as a Buffer Default utf8
runFirst: true, // get the body before any preParsing hook change/uncompress it. Default false
routes: // array of routes, global will be ignored, wildcard routes not supported

// A POST route to handle form submissions
fastify.post(“/pages/checkout/confirmation”, {
config: {
// add the rawBody to this route. if false, rawBody will be disabled when global is true
rawBody: true
handler (request, reply) {
let params = null;

console.log("### ");

// request.body.paramName <-- a form post example
return reply.view(
  "/public/resources/checkout/checkoutConfirmation.html", params);


you should probably put your code in code blocks so it’s easier to read or understand.

you have this big fastify-raw-body middleware, which is documented as providing the request.rawBody property, but you’re asking about request.body. why are you using the fastify-raw-body middleware?

Thanks for the replies. I have figured out the resolution. I am using bootstrap form in my html but I haven’t defined ‘name’ attribute for each input element. After defining name attribute, form submit is now working.