Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use client-transcribe-streaming with AWS_PROFILE ENV assumed_role Credentials #2533

Closed
brgaulin opened this issue Jun 29, 2021 · 4 comments
Assignees
Labels
bug This issue is a bug.

Comments

@brgaulin
Copy link

brgaulin commented Jun 29, 2021

Describe the bug

When doing local development, and using AWS_PROFILE env var to help select the correct credentials/assume the correct role, the transcribe API is unable to work on its own.

Your environment

SDK version number

@aws-sdk/client-transcribe-streaming@3.19.0

Is the issue in the browser/Node.js/ReactNative?

Node.js

Details of the browser/Node.js/ReactNative version

$ node -v
v14.17.0

Relevant ~/.aws/config

[default]
region = us-east-1
output = json

[profile dev]
region = us-east-1
role_arn = arn:aws:iam::123456789:role/dev-role
source_profile=default

Relevant ~/.aws/credentials

[default]
aws_access_key_id = ACCESS_KEY_IS_HERE
aws_secret_access_key = SECRET_KEY_IS_HERE

Steps to reproduce

const {
  TranscribeStreamingClient,
  StartStreamTranscriptionCommand,
  PartialResultsStability,
  MediaEncoding,
  LanguageCode,
} = require('@aws-sdk/client-transcribe-streaming')

const transcribeClient = new TranscribeStreamingClient({ region: 'us-east-1' })

const transcribeInput = async function* () {
  for await (const chunk of process.stdin) {
    if (chunk.length > 6000) continue
    yield { AudioEvent: { AudioChunk: chunk } }
  }
}

const transcriptionCommand = new StartStreamTranscriptionCommand({
  LanguageCode: LanguageCode.EN_US,
  MediaSampleRateHertz: 16000,
  MediaEncoding: MediaEncoding.PCM,
  AudioStream: transcribeInput(),
  EnablePartialResultsStabilization: true,
  PartialResultsStability: PartialResultsStability.MEDIUM
})

transcribeClient.send(transcriptionCommand)
  .then(() => console.log('Success!'))
  .catch((err) => console.log('Fail', err))

Observed behavior

$ node ./src/test.js
Success!

$ AWS_PROFILE=dev node ./src/test.js
Fail Error [ERR_HTTP2_ERROR]: Protocol error
    at Http2Session.onSessionInternalError (internal/http2/core.js:754:26) {
  code: 'ERR_HTTP2_ERROR',
  errno: -505,
  '$metadata': { attempts: 1, totalRetryDelay: 0 }
}

Expected behavior

Both examples would succeed

Additional context

If I add in an s3:ListBuckets command above the transcribe client, I do notice that switching profiles does switch the output of the S3 command results, so it seems the s3 client is working ok with this type of auth, but something is up with transcribe

@brgaulin brgaulin added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 29, 2021
@brgaulin
Copy link
Author

brgaulin commented Jun 29, 2021

I'm not sure if this should work out of the box, but I did find a workaround:

const {
  TranscribeStreamingClient,
  StartStreamTranscriptionCommand,
  PartialResultsStability,
  MediaEncoding,
  LanguageCode,
} = require('@aws-sdk/client-transcribe-streaming')

const { fromIni } = require("@aws-sdk/credential-provider-ini");
const { getDefaultRoleAssumer } = require("@aws-sdk/client-sts")
const transcribeClient = new TranscribeStreamingClient({ region: 'us-east-1', credentials: fromIni({
  profile: 'dev',
  roleAssumer: getDefaultRoleAssumer()
 })
})

@vudh1 vudh1 self-assigned this Nov 8, 2021
@vudh1
Copy link

vudh1 commented Dec 6, 2021

Hi @brgaulin, please response if you still experience this in the latest version of SDK.

@vudh1 vudh1 added response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Dec 6, 2021
@brgaulin
Copy link
Author

brgaulin commented Dec 6, 2021

Hello @vudh1 . Unfortunately I am no longer with an organization that is using AWS and this would be incredibly difficult for me to test. If you think this has been resolved in a newer version, this should be safe to close.

In the event someone else stumbles across this post, they could make a new issue and reference the details here

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. label Dec 7, 2021
@vudh1 vudh1 closed this as completed Feb 18, 2022
@github-actions
Copy link

github-actions bot commented Mar 5, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants