AWS Transcribe javascript API UnexpectedParameter: Unexpected key 'OutputBucketName' found in params

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



AWS Transcribe javascript API UnexpectedParameter: Unexpected key 'OutputBucketName' found in params



I am calling the AWS Transcribe service from a Lambda



Lambda code:


module.exports.createTranscribeJob = (event, context, callback) =>
const region = event.Records[0].awsRegion;
const bucket = event.Records[0].s3.bucket.name;
const key = event.Records[0].s3.object.key;
const transcribeservice = new AWS.TranscribeService(apiVersion: '2017-10-26');

// Set the transcribeservice startTranscriptionJob params
const params =
LanguageCode: 'en-US',
Media:
MediaFileUri: `https://s3-$region.amazonaws.com/$bucket/$key`
,
MediaFormat: 'mp3',
TranscriptionJobName: key,
MediaSampleRateHertz: 0,
OutputBucketName: bucket
;

// call startTranscriptionJob with the params
transcribeservice.startTranscriptionJob(params, function(err, data)
if (err)
console.log(err, err.stack);
else
console.log(data);

);

callback(null);
;



I set the version of the API I want to use new AWS.TranscribeService(apiVersion: '2017-10-26')


new AWS.TranscribeService(apiVersion: '2017-10-26')



When I call transcribeservice.startTranscriptionJob the job fails with this error:


transcribeservice.startTranscriptionJob


UnexpectedParameter: Unexpected key 'OutputBucketName' found in params
at ParamValidator.fail (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:50:37)
at ParamValidator.validateStructure (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:77:14)
at ParamValidator.validateMember (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:88:21)
at ParamValidator.validate (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:34:10)
at Request.VALIDATE_PARAMETERS (/var/runtime/node_modules/aws-sdk/lib/event_listeners.js:125:42)
at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at callNextListener (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:95:12)
at /var/runtime/node_modules/aws-sdk/lib/event_listeners.js:85:9
at finish (/var/runtime/node_modules/aws-sdk/lib/config.js:320:7)
at /var/runtime/node_modules/aws-sdk/lib/config.js:338:9
message: 'Unexpected key 'OutputBucketName' found in params',
code: 'UnexpectedParameter',
time: 2018-07-19T12:50:58.278Z



If I remove OutputBucketName: bucket it works, so I know its not a permissions issue


OutputBucketName: bucket



Looking at the Source code for AWS Javascript sdk OutputBucketName is defined as a member of StartTranscriptionJobRequest
https://github.com/aws/aws-sdk-js/blob/75978fcfe4186d5a310e9b5c6d6328e90997edf0/apis/transcribe-2017-10-26.normal.json#L491


OutputBucketName


StartTranscriptionJobRequest



My only guess is lambda is not using the correct SDK even though I state the API version.



Any help is appreciated, please let me know if I have an error on my side.



Thanks




2 Answers
2



The problem is AWS Lambda does not use the latest JS SDK



The solution is to include the latest JS SDK in your own node_module folder



npm install aws-sdk


npm install aws-sdk



Then your lambda code will use the latest version of the SDK



Thanks John !!. This solution worked, If you where previously editing directly in the web UI, you will loose the ability to edit the code inline.



Export Function



Then once you download, unzip and run the command posted by John.


npm install aws-sdk



Finally, zip it back up, make sure your zip includes the node_modules directory as well as the .js files you originally downloaded






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered