"无法读取属性' accessKeyId' of null"错误。当尝试使用' aws-Amplify'进行API调用时

时间:2018-03-23 06:50:44

标签: react-native aws-cognito aws-amplify

安装应用程序后第一次尝试发出API请求时,获取“访问密钥”。 of null"错误,一旦应用程序终止并重新启动,所有API请求都正常工作。

aws-amplify配置如下。

Amplify.configure({
    Auth: {
        region: 'xxx', 
        identityPoolId: 'xxx',
        userPoolId: 'xxx', 
        userPoolWebClientId: 'xxx',
    },
    API: {
        endpoints: [
            {
                name: "xxx",
                endpoint: "xxx"
            }
        ]
    }
});

下面的AWS身份验证配置

AWS.config.update({ region: "xxx",accessKeyId:"xxx",secretAccessKey:"xxx" });

    export const poolData = {
      UserPoolId: "xxx",
      ClientId: "xxx",
    };

    export const userPool = new AWS.CognitoIdentityServiceProvider.CognitoUserPool(poolData);

使用" react-native-aws-cognito-js:0.0.7"用于身份验证和" aws-amplify:^ 0.2.3"用于API调用

This is the error appears for the first time when API request is made using aws-amplify

1 个答案:

答案 0 :(得分:0)

你能试试aws-amplify的版本是0.2.14吗?