AWS DynamoDB:"错误:配置中缺少区域" - 即使使用' config.region'返回&eu-west-1'

时间:2017-10-10 05:40:32

标签: amazon-web-services amazon-s3 amazon-dynamodb aws-api-gateway

在遵循AWS文档以在我的前端项目中设置DynamoDB的同时,从API引发的文档中获取设置:

 public class SumMinMaxArgs {
    // TODO - write your code below this comment.
    // You will need to write three methods:
    //
    // 1.) A method named sumArray, which will return the sum
    //     of the given array.  If the given array is empty,
    //     it should return a sum of 0.
    //
    // 2.) A method named minArray, which will return the
    //     smallest element in the given array.  You may
    //     assume that the array contains at least one element.
    //     You may use your min method defined in lab 6, or
    //     Java's Math.min method.
    //
    // 3.) A method named maxArray, which will return the
    //     largest element in the given array.  You may
    //     assume that the array contains at least one element.
    //     You may use your max method defined in lab 6, or
    //     Java's Math.max method.
    // 





    // DO NOT MODIFY parseStrings!
    public static int[] parseStrings(String[] strings) {
        int[] retval = new int[strings.length];
        for (int x = 0; x < strings.length; x++) {
            retval[x] = Integer.parseInt(strings[x]);
        }
        return retval;
    }

    // DO NOT MODIFY main!
    public static void main(String[] args) {
        int[] ints = parseStrings(args);
        System.out.println("Sum: " + sumArray(ints));
        System.out.println("Min: " + minArray(ints));
        System.out.println("Max: " + maxArray(ints));
    }
}

我的设置:

Error: Missing region in config
    at constructor.<anonymous> (aws-sdk-2.129.0.min.js:42)
    at constructor.callListeners (aws-sdk-2.129.0.min.js:44)
    at i (aws-sdk-2.129.0.min.js:44)
    at aws-sdk-2.129.0.min.js:42
    at t (aws-sdk-2.129.0.min.js:41)
    at constructor.getCredentials (aws-sdk-2.129.0.min.js:41)
    at constructor.<anonymous> (aws-sdk-2.129.0.min.js:42)
    at constructor.callListeners (aws-sdk-2.129.0.min.js:44)
    at constructor.emit (aws-sdk-2.129.0.min.js:44)
    at constructor.emitEvent (aws-sdk-2.129.0.min.js:43)

我错过了什么?

2 个答案:

答案 0 :(得分:0)

看起来你正在新建AWS.config。

更改行

display:inline;

display:inline-block;

<强>参考:

http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-region.html

希望它有所帮助。

答案 1 :(得分:0)

对于遇到相同问题的其他人,文档提到的地方:

  

如果您尚未创建,请创建一个标识池 ...

您已转发至Amazon Cognito服务,请选择管理联邦身份,而不是管理用户池选项。