getImage() returns "Error: Bad response status code 301"

Hi,
I am trying to run the github example for getImage() function and i am getting the error “Bad response status code 301”.

github-example:

var plotly = require('plotly')('username','apiKey');
var fs = require('fs');

var trace1 = {
  x: [1, 2, 3, 4],
  y: [10, 15, 13, 17],
  type: "scatter"
};

var figure = { 'data': [trace1] };

var imgOpts = {
    format: 'png',
    width: 1000,
    height: 500
};

plotly.getImage(figure, imgOpts, function (error, imageStream) {
    if (error) return console.log (error);

    var fileStream = fs.createWriteStream('1.png');
    imageStream.pipe(fileStream);
});

The same code was working fine two days ago, so i believe that the issue is related to the new url change.

Thanks for your help,
Thomas

2 Likes

Same here, I have a service using that function and has been working for almost a year without problems, but suddenly start to fail.

1 Like

started having the same issue around the same time as you. still not working today. it’s been working for a couple years straight with no problems.

related, had a similar issue a couple years ago

still getting this error. anyone figure it out?