preSigned URLS Promise TypeError: res.json is not a function NodeJS responses error

preSigned URLS Promise TypeError: res.json is not a function NodeJS responses error

我正在尝试为存储在我的私有 s3 存储桶中的文件创建一个预签名 url 数组,但由于 res.json 函数错误,我似乎无法 return 它们.尽管有很多线程有同样的问题,我还是想不通。我的代码有什么问题?

const express = require('express');
const AWS = require('aws-sdk');
let config = require('./config');
let app = express();

var s3 = new AWS.S3();
s3.config.update({
    accessKeyId: config.accessKeyId,
    secretAccessKey: config.secretAccessKey,
    region: 'us-east-2'
});



// Create an array that houses pre-signed Urls
// Loop through x amt of times (depending on number of documents)
// Push each url into an array called 'preSignedUrls'
// Exit loop and reset array to re-generate new urls
var router = express.Router();


function getSignedURL(res) {
    Key = ['file1.pdf', 'file2.pdf'];
    let promises = [];
    let i = 0;
    while(i < Key.length){

        var params = {
            Bucket: 'bucketname',
            Key: Key[i],
            Expires: 36000
        };

        promises.push(s3.getSignedUrlPromise('getObject', params));
        console.log(promises)
        i++;
    }
    Promise.all(promises)
    .then( response => {
        res.json(response);
    }, function(err) { 
    console.log(err);
    });

}


router.route('/get_signed_url')
.get(getSignedURL);
//                 if (err) {
    // console.log(err);
    // return next(err);

router.route('/get_signed_url')
app.use('/v1', router);

var PORT = process.env.PORT || 3001;
var HOST = process.env.HOST || '11.123.346.789';

console.log("Listening on", HOST, PORT);
app.listen(PORT, HOST);

这是我得到的: (node:6717) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): TypeError: res.json is not a function

请求控制器的签名是getSignedURL(req, res ),响应对象是第二个而不是第一个