using role instead of keys to get signed url in s3 but nothing returned and no errors

后端 未结 1 961
盖世英雄少女心
盖世英雄少女心 2021-01-23 07:19

I tried if I use access key, it works fine but I am trying to get ride of access key and using role instead, but once I get ride of access key. what I get in return is ww

相关标签:
1条回答
  • 2021-01-23 07:37

    You can't use getSignedUrl() synchronously when using IAM roles.

    Note: You must ensure that you have static or previously resolved credentials if you call this method synchronously (with no callback), otherwise it may not properly sign the request. If you cannot guarantee this (you are using an asynchronous credential provider, i.e., EC2 IAM roles), you should always call this method with an asynchronous callback.

    https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#getSignedUrl-property

    s3.getSignedUrl('getObject', params, function (err, url) {
      console.log('The URL is', url);
    });
    
    0 讨论(0)
提交回复
热议问题