Hi all,
Apologies I’m very new to postman. This is either a bug or i’m missing something very obvious.
I use a curl command on linux to remotely get instance status and to start and stop an oracle cloud (oci) instance (VM).
I am trying to do the same using postman.
I have followed the instructions on the below link
Invoking Oracle OCI REST APIs using Postman to Start/Stop the instance as well as many many other websites.
While I can Get instance information proving that the authentication is working correctly when I try and send POST request to start and stop the instance I get the below error message.
There was an error in evaluating the Pre-request Script:TypeError: Cannot read properties of undefined (reading ‘length’).
The environment settings are the attached, There is a length field which i have tried populating, I have also tried removing it but the error message stays the same
Headers with errrors
\
Can someone point me in the right direction? I have search postman forums, oracle support website and also google but no luck.
Thanks
Regards
Ed
Hey @flight-operator-3342 
Welcome to the Postman community 
As your request screenshot doesn’t show anything in the pre-request script, I can only assume that it’s something at the Collection level.
If you click on the Collection name in the breadcrumb above the URL bar. That should open the Collection in a new tab.
Does that contain anything in the pre-request tab?
Hi Danny,
There was an entry in the Pre-request Script of the parent collection.
I changed
var body = "";
if(methodsThatRequireExtraHeaders.indexOf(request.method.toUpperCase()) !== -1) {
body = pm.request.body.raw;
//pm.environment.set("length", body.length);
var content_length_header = "content-length: "+ body.length ;
}
to
var body = "";
if (methodsThatRequireExtraHeaders.indexOf(request.method.toUpperCase()) !== -1) {
if (pm.request.body && pm.request.body.raw) {
body = pm.request.body.raw;
}
var content_length_header = "content-length: " + body.length;
And now the start and stop works correctly.
I am unsure how this worked for other people but with the update it now works for me.
Thanks.
Ed