Day 47: Stop Calling Third-Party APIs on Page Load (CQRS Lite in AWS Lambda)
Are you fetching data from external APIs directly inside your user-facing Lambda functions? Stop. I was doing exactly this with the Plaid API for my AI Financial Agent, and it was destroying my app...

Source: DEV Community
Are you fetching data from external APIs directly inside your user-facing Lambda functions? Stop. I was doing exactly this with the Plaid API for my AI Financial Agent, and it was destroying my application's performance. External APIs are slow, prone to rate-limiting, and can go down without warning. The Solution: Today, I refactored my Lambda function to completely decouple data ingestion from data serving. Instead of calling client.transactions_get() every time the React frontend makes a request, the Lambda now relies solely on Amazon DynamoDB for read operations. Python The Read Path is now Lightning Fast ⚡ def get_transactions_from_dynamo(user_id): response = table.query( KeyConditionExpression=Key('user_id').eq(user_id) ) return [item for item in response.get('Items', []) if item.get('transaction_id') != 'METADATA'] How does new data get in? I configured an Amazon EventBridge rule that triggers the Lambda once a day behind the scenes. The Lambda detects the aws.events source, hits