Node.js axios get、put、post方法请求失败,状态代码403

Node.js axios get、put、post方法请求失败,状态代码403,node.js,express,axios,Node.js,Express,Axios,当我在函数中执行以下代码时,它显示上述错误。直到有一段时间,它工作得非常好,但现在突然不工作了 Error: Request failed with status code 403 at createError (C:\Yatin\API\node_modules\axios\lib\core\createError.js:16:15) at settle (C:\Yatin\API\node_modules\axios\lib\core\settle.js:17:12)

当我在函数中执行以下代码时,它显示上述错误。直到有一段时间,它工作得非常好,但现在突然不工作了

Error: Request failed with status code 403
    at createError (C:\Yatin\API\node_modules\axios\lib\core\createError.js:16:15)
    at settle (C:\Yatin\API\node_modules\axios\lib\core\settle.js:17:12)
    at IncomingMessage.handleStreamEnd (C:\Yatin\API\node_modules\axios\lib\adapters\http.js:237:11)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
var azureREST\u listContainerURI=
axios({
方法:“get”,
url:azureREST_listContainerURI
})
.然后(功能(响应){
parser.parseString(response.data,函数(err,result){
如果(错误)抛出错误
对于(让result.EnumerationResults.Containers[0].Container的containerObj)
{
var containerobject={
“名称”:containerObj['Name'][0],
“财产”:{
“上次修改”:containerObj['Properties'][0]['last-modified'][0]
}
}
customJSONResponse['containers'].push(containerobject);
}
res.send(customJSONResponse)
})
})
.catch(函数(错误){
res.send({error:error})
console.log(error.stack)
log(“调用Azure REST端点时出错:”+错误);
});

这不起作用,并且显示了上面的错误,尽管当我尝试通过在axios.get in single quotes中硬编码url参数来执行相同的代码时,它工作得非常好

您是在(本地)Web服务器中运行该文件,还是直接打开该文件?您是否检查了
azureREST\u listContainerURI
变量的内容?我在本地Web服务器中运行该变量,该变量的内容非常好,因为当我将其记录到控制台URL时,会返回结果您是在(本地)Web服务器中运行该变量,还是直接打开该文件?您是否检查了
azureREST\u listContainerURI
变量的内容?我在本地Web服务器中运行它,变量的内容非常好,因为当我将其记录到控制台时,URL会返回结果
var azureREST_listContainerURI = <URL_that is generated here by calling other functions>
axios({
            method: 'get',
            url: azureREST_listContainerURI
          })
           .then(function (response) {

            parser.parseString(response.data, function (err, result) {
                if(err) throw err
              for(let containerObj of result.EnumerationResults.Containers[0].Container)
              {
                  var containerobject = {
                      "Name":containerObj['Name'][0],
                      "properties":{
                          "last_modified":containerObj['Properties'][0]['Last-Modified'][0]
                          }
                      }
                      customJSONResponse['containers'].push(containerobject);
              }
              res.send(customJSONResponse) 
           })
          })
           .catch(function (error) {
           res.send({error:error})
           console.log(error.stack)
            console.log("Error while calling Azure REST endpoint : " + error);
           });