AWS Amplify SDK for ReactNativeとAPIGatewayのIAMAuthorizerを使用して簡単なgetリクエストを作成しようとしています。常に次のエラーメッセージが表示されます。
資格情報は、「us-east-1」ではなく、有効なリージョンにスコープする必要があります。
私は何が間違っているのですか?これが私のコードです(まだ何もしていません):
function getImageIdForUpload() {
let apiName = 'MyAPIGatewayAPI';
let path = '/upload-image/get-new-id';
let myInit = {
// replace this with attributes you need
};
API.get(apiName, path, myInit).then(response => {
console.log(response)
}).catch(error => {
console.error(error.response)
});
}
私の設定:
Auth: {
// REQUIRED - Amazon Cognito Identity Pool ID
identityPoolId: 'eu-central-1:xxxx',
// REQUIRED - Amazon Cognito Region
region: 'eu-central-1',
// OPTIONAL - Amazon Cognito User Pool ID
userPoolId: 'eu-central-1_xxxx',
// OPTIONAL - Amazon Cognito Web Client ID
userPoolWebClientId: 'xxxx',
},
どんな助けもいただければ幸いです:)
自分で解決策を見つけました:API構成でリージョンを設定する必要があります。
例:
API: {
endpoints: [
{
name: "MyAPIGatewayAPI",
endpoint: "https://xxx.execute-api.eu-central-1.amazonaws.com/dev",
region: "eu-central-1"
}
]
},
APIが「エッジ最適化」に設定されている場合は問題にならない可能性があります。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加