aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.81k stars 819 forks source link

Transcribe doesn't work in some regions with configuration Amplify CLI created #3947

Closed tkashi closed 4 years ago

tkashi commented 4 years ago

Describe the bug When we configure Amplify app to use Amazon Transcribe in the Predictions category with a user in some regions, it doesn't work with the current AWS SDK actually. For example, as the below example, if we use ap-northeast-1 as a region, then Predictions.convert produces a WebSocket connection error.

Amplify CLI Version 4.17.2

To Reproduce

  1. Using a user of ap-northeast-1, configure Transcribing text function via Amplify CLI with the default setting, which produces an aws-export.js like
    const awsmobile = {
    "aws_project_region": "ap-northeast-1",
    "aws_cognito_identity_pool_id": "ap-northeast-1:1111111111-b410-4aa8-be12-c234371bbb54",
    "aws_cognito_region": "ap-northeast-1",
    "aws_user_pools_id": "ap-northeast-1_xxxxxxxxx",
    "aws_user_pools_web_client_id": "xxxxxxxxxxxxxxxxxxxxxxx",
    "oauth": {},
    "predictions": {
        "convert": {
            "transcription": {
                "region": "ap-northeast-2",
                "proxy": false,
                "defaults": {
                    "language": "en-US"
                }
            }
        }
    }
    };
  2. Create an app with amplify-sdk (@aws-amplify/predictions@3.1.6) which just runs Prediciton.convert({transcription}), e.g.
    
    import Amplify from '@aws-amplify/core';
    import Auth from '@aws-amplify/auth';
    import Predictions, {AmazonAIPredictionsProvider} from '@aws-amplify/predictions';
    import awsconfig from './aws-exports';

Amplify.configure(awsconfig); Amplify.addPluggable(new AmazonAIPredictionsProvider());

Auth.currentCredentials().then(() => { Predictions.convert({ transcription: { source: { bytes: [] } }, }); });



**Expected behavior**
The reason of this bug is because the current implementation of the AWS SDK is based on Streaming Transcription, but some regions (e.g. ap-northeast-1 and ap-northeast-2) don't support it. Amplify CLI should use another region if that of a user doesn't support Streaming Transcription.

**Screenshots**
<img width="568" alt="Screen Shot 2020-04-13 at 9 51 20" src="https://user-images.githubusercontent.com/1989039/79084566-68b8ba00-7d6f-11ea-9515-0aac62860d57.png">

**Desktop (please complete the following information):**
 - OS: Mac Mojave
 - Node: 12.16.1

**Additional context**
N/a
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically closed because of inactivity. Please open a new issue if you are still encountering problems.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.