2.7 KiB
2.7 KiB
Troubleshooting - Collecting Debug Output
Step 1: Make sure you have a .env file set up
Check that you have a .env file with at least:
YNAB_API_TOKEN=your_token
YNAB_BUDGET_ID=your_budget_id
OPENAI_API_KEY=your_openai_key
Step 2: Start the server
In your terminal, run:
bun --hot server.ts
You should see:
🚀 Server running at http://localhost:3000
Step 3: Open the web interface
Open your browser and go to:
http://localhost:3000
Step 4: Start the scraping process
- On the web page, make sure "Use Unapproved Transactions Only" is checked (it should be by default)
- Click the "Fetch & Match Transactions" button
Step 5: Log in to Amazon manually
A browser window will open automatically. You have 45 seconds to:
- Log in to Amazon if prompted
- Complete any 2FA or CAPTCHA
- Wait for the transactions page to load
Step 6: Watch the terminal output
Back in your terminal where you ran bun --hot server.ts, you'll see output like:
Navigating to Amazon transactions page...
Please log in manually if needed. The browser will wait for you.
Waiting 45 seconds for you to complete login (if needed)...
Screenshot saved to debug-transactions-page.png
HTML saved to debug-transactions-page.html
Extracting transaction data...
Debug Info:
- Total divs on page: 1234
- Relevant class names found: [ ... ]
- Data-testid attributes found: [ ... ]
- First 500 chars of page: ...
Extracted 0 transactions
WARNING: No transactions were extracted from the page!
Step 7: Collect the debug files
After the scraping completes, you'll have two new files in your project folder:
debug-transactions-page.png- Screenshotdebug-transactions-page.html- Full HTML
Step 8: Analyze the HTML (optional)
Run this to see what's in the HTML:
bun inspect-page.ts
What to share for help
Copy and paste:
- The entire terminal output from "Debug Info:" onwards
- Look at
debug-transactions-page.png- does it show your transactions? - If you can, share the output from
bun inspect-page.ts
Quick Test
If you just want to test the scraper without the full app, you can create a simple test file:
// test-scraper.ts
import { AmazonScraper } from './amazon-scraper';
const scraper = new AmazonScraper();
const endDate = new Date();
const startDate = new Date();
startDate.setDate(startDate.getDate() - 30);
const orders = await scraper.scrapeOrders(startDate, endDate);
console.log('Orders found:', orders.length);
console.log('Orders:', JSON.stringify(orders, null, 2));
Then run:
bun test-scraper.ts
This will open the browser, let you log in, and show you all the debug output!