Openstack npm pkgcloud createImage() function not working

I am trying to create an image of an instance in openstack using npm pkgcloud. For this I am using the code as below:

var openstack_client_compute = null;
openstack_client_compute = pkgcloud.compute.createClient({
provider: PROVIDER, // required
username: USERNAME, // required
password: PASSWORD, // required
region: REGION,
authUrl: AUTH_URL // required
});
options = {
name: ‘image1’, // required
server: ‘0e4d56a2-173a-425d-befd-cec366605522’ // required
};
openstack_client_compute.createImage(options, function(err, image){
if(err){
console.log(err);
}
console.log(image);
});

I am getting the following error :

name: ‘Error’, provider: ‘openstack’, failCode: ‘Service Unavailable’, statusCode: 503, href: ‘http://controller:8774/v2.1/6af81940df89199f088beba7d93/servers/0e4d56a2-173a-425d-befd-cec366605522/action’,method: ‘POST’, headers: { server: ‘squid’, ‘mime-version’: ‘1.0’, date: ‘Mon, 09 Apr 2018 07:21:15 GMT’, ‘content-type’: ‘text/html;charset=utf-8’, ‘content-length’: ‘3012’, ‘x-squid-error’: ‘ERR_DNS_FAIL 0’, ‘x-cache’: ‘MISS from lproxy’, ‘x-cache-lookup’: ‘MISS from proxy:8080’, connection: ‘close’ },

Someone with a possible solution on how to fix this, do answer?

Note : other functions such as createStack deleteStack getStack etc are functioning properly

Hi @mrsinha,
while I have no prior experience with pkgcloud, I can only suggest from what you have written that there is some problem with the server (seeing as you are getting a 503 error)

According to https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html:

10.5.4 503 Service Unavailable
The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response.

  Note: The existence of the 503 status code does not imply that a
  server must use it when becoming overloaded. Some servers may wish
  to simply refuse the connection.

If other server requests are working, then there might be something wrong with the configuration you are sending.

Hope that helps.