I am confused about aws-sdk for react, trying to configure it throws error which is a bit confusing, considering the object looks fine in the debugger, but the moment that I step over it throws error: TypeError: Unable to get property 'config' of undefined or null reference
the code:
import {AWS, CustomEvent, AMA} from 'aws-sdk';
class App extends Component {
constructor(props) {
debugger;
AWS.config.region = 'us-east-1';
...
I assumed that once imported the AWS included config object, and if I were to attach with debugger (at the debugger;
line) the AWS object looks good and so does the AWS.config and further AWS.config.region is set to null, but if I step, it throws the above error.... Any thoughts what may be misconfigured?
I had the same issue, I solved it with:
import AWS from 'aws-sdk';
AWS.config.region = 'us-east-1';
For some reason it is the import { AWS } as opposed to import AWS that caused the error