Search code examples
vue.jsamazon-textract

VueJS - WEBPACK_IMPORTED_MODULE_0___default.a.Textract is not a constructor


I've been trying to use Textract in VueJs, and I'm getting the following error "aws_sdk__WEBPACK_IMPORTED_MODULE_0___default.a.Textract is not a constructor", i'm using aws-sdk version 2.450.0 and i don't know how to solve it...

I made some tests to see if it was an import error, i tried to use S3 and Lambda contructor, both of then worked accordinly, i even tested configuring the access configurations in order to avoid an permission error, but i get the same problem.

On a component file, on the script tag i've written this,

import AWS from 'aws-sdk'
AWS.config.update({
  region: 'us-east-1',
  accessKeyId: <my-access-Key>,
  secretAccessKey: <my-secret-access-key>

});

and in methods, inside a function, the following command returns the error.

var textract = new AWS.Textract();

Solution

  • Apparently, Textract client isn't supposed to work on the browser environment, at least until the version 2.454.0, as someone else responded on my other post. https://github.com/aws/aws-sdk-js/issues/2657