so I’ve been working with Fivetran for a while and I’ve gotten used to hitting their API endpoints. But now, I’ve got to switch gears and work with AWS AppFlow, which is totally new territory for me.
Right now, I’m working on a React App and I’m struggling to figure out how to make it talk to AppFlow. I tried installing ‘aws-sdk’, but when I tried to import AWS from it, all I got was a nasty error message.
This is my aws-config.js
file inside my React application:
import AWS from 'aws-sdk';
AWS.config.update({
region: process.env.NX_REACT_APP_REGION,
credentials: {
accessKeyId: process.env.NX_REACT_APP_ACCESS,
secretAccessKey: process.env.NX_REACT_APP_SECRET,
},
});
export const appflow = new AWS.Appflow();
Then I’m importing it inside my component import {appflow} from '../../../../../aws-config';
but when I reload the page I get this error
TypeError
aws_sdk__WEBPACK_IMPORTED_MODULE_0___default(…).Appflow is not a constructor
I’ve been searching around online trying to figure out how to make requests to AppFlow, but I gotta admit, I’m pretty stumped. Can anyone lend a hand? Any advice or guidance would be really appreciated.
Thanks in advance!
2
Answers
I had trouble with this too, did you setup up aws-sdk and if so, how?
You could try this:
In your React app, create a file (e.g., aws-config.js) to store your AWS credentials and configuration. Import the AWS SDK and set your credentials like this:
Replace ‘YOUR_AWS_REGION’, ‘YOUR_ACCESS_KEY_ID’, and ‘YOUR_SECRET_ACCESS_KEY’ with your actual AWS region and credentials.
Once your AWS configuration is set up, you can start making requests to AWS AppFlow. For example, you can use the createFlow method to create a new flow in AppFlow:
Do the same replacing thing explained before and it should work but also, the appflow documentation has some samples if not you could check out in the AWS Development Community page, here: https://community.aws/
Hope this works and wish you the best of lucks, have a great day!
You can check this npm package.