Express JS Node JS

Fix HPE_INVALID_METHOD Error in Node.JS (Hapi/Fastify/Express)

Node.JS images, logo
Written by Vithal Reddy

When You’re Making HTTP request in Node.JS Server Written In Node.JS Rest API Frameworks such Express.js, Hapi.js, Fastify.js and Many more, Suddenly, you encounter error “parse Error: Invalid method encountered”, “stack”: Error: Parse Error: Invalid method encountered “bytesParsed”: 0, “code”: “HPE_INVALID_METHOD””, Don’t Panic it’s very not any programming mistake, rather simple typo mistake.

What you’re trying to do is, trying to access `https://` instead of http:// . Go Ahead try it, it will work.

Thanks stackoverflow user for solution Roman.

About the author

Vithal Reddy

Vithal Reddy is a seasoned technology professional with expertise in Full Stack Web development, Micro services and Scaling infrastructure on Cloud.
More at