Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Ive tried with Ubuntu’s LTS version of nodejs which is < 8 and it gave me the same error, so nodejs version is irelevant. I tried doing the request in curl and it worked fine so the issue is within nodejs.
SOLVED.
I did a pretty obvious mistake in my code above, i added all the options properties in the headers object.
What i did:
const options = {
headers: {
host: 'api.example.com',
path: '/base',
port: 443,
method: 'POST',
'Content-Type': 'application/x-www-form-urlencoded;',
'Content-Length': Buffer.byteLength(postData),
}
};
What i should have done (the correct way):
const options = {
host: 'api.example.com',
path: '/base',
port: 443,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded;',
'Content-Length': Buffer.byteLength(postData)
}
};
So if you are getting this issue, double check your code formatting, sometimes the issue is just an simple flaw!