Overview
This guide covers the most common issues you may encounter when running the Siigo Corprecam Scraper and their solutions.Environment Variable Issues
Error: Missing NGROK_AUTHTOKEN
Error: Missing NGROK_AUTHTOKEN
Symptom: Server fails to start or ngrok tunnel doesn’t establish.Cause: The
NGROK_AUTHTOKEN environment variable is not set in your .env file.Solution:- Get your ngrok auth token from ngrok dashboard
- Add it to your
.envfile:
- Restart the server
config.ts:7 and server.ts:46-49Error: Missing Siigo Credentials
Error: Missing Siigo Credentials
Symptom: Login fails or automation stops at login page.Cause: Missing Related Code: See
USER_SIIGO_CORPRECAM or PASSWORD_SIIGO_CORPRECAM in environment variables.Solution:Add your Siigo credentials to .env:config.ts:8-9 and main.ts:23-24Error: Database Connection Failed
Error: Database Connection Failed
Symptom: Server starts but API requests fail with database errors.Cause: Missing or incorrect database configuration.Solution:Verify all database environment variables in Test the connection:Related Code: See
.env:config.ts:10-14Playwright Timeout Issues
TimeoutError: Waiting for selector timed out
TimeoutError: Waiting for selector timed out
Symptom: Script fails with timeout error after 30-60 seconds.Cause: Page elements not loading within expected time, or incorrect selectors.Common Locations:If timeouts persist:
- Login page:
#siigoSignInName,#siigoPassword - Company selection:
trwith company NIT - Document creation:
a[data-value="Documento soporte"] - Product input:
#trEditRow #editProduct #autocomplete_autocompleteInput
- Check your internet connection
- Verify Siigo website is accessible
- Run with headless: false to see what’s happening (see Debugging Guide)
utils/functions.ts:25, utils/functions.ts:35, utils/functions.ts:47Error: Element not visible or clickable
Error: Element not visible or clickable
Symptom: Script fails with “element is not visible” or “element is outside viewport”.Cause: Angular animations, modal overlays, or dynamic content loading.Solution:The scraper includes built-in retry logic for these scenarios:If the issue persists:
- The element may have changed in Siigo’s UI
- Check for blocking modals or notifications
- Increase retry attempts if needed
utils/retryUntilSucces.ts:1-31Error: Selector matched multiple elements
Error: Selector matched multiple elements
Symptom: Script clicks wrong element or throws “multiple elements found” error.Cause: Non-specific selector matches more than intended.Solution:The scraper uses precise selectors with context:Related Code: See
utils/functions.ts:42-45 for company selection exampleNgrok Connection Issues
Error: Ngrok tunnel failed to start
Error: Ngrok tunnel failed to start
Symptom: Server starts but ngrok tunnel doesn’t establish.Possible Causes:Change port in Verify ngrok configuration:Related Code: See
- Invalid auth token - Check your ngrok dashboard
- Port already in use - Another process is using port 3000
- Network restrictions - Firewall blocking ngrok
- Free plan limits - Too many active tunnels
.env:server.ts:46-51Ngrok URL not updating in database
Ngrok URL not updating in database
Symptom: Tunnel starts but webhook URL not accessible.Cause: The
setNgrok() function failed to update the database.Solution:- Check database connection
- Verify the PHP endpoint is accessible:
- Check server logs for ngrok URL
api/php.ts:78-89 and server.ts:51Siigo Login and Form Issues
Login fails repeatedly despite correct credentials
Login fails repeatedly despite correct credentials
Symptom: Retry logic exhausted, login never succeeds.Possible Causes:
- Siigo website changes - UI elements changed
- Captcha or security check - Manual verification required
- Session/cookie issues - Previous session interfering
- Wrong company NIT - Automation looking for wrong company
- Run with
headless: falseto see login attempt:
- Verify the company NIT matches:
- Clear browser state and retry
utils/functions.ts:12-89 and main.ts:25, main.ts:38Error: Provider (Proveedor) not found
Error: Provider (Proveedor) not found
Symptom: Script fails when searching for provider by NIT.Cause: Provider doesn’t exist in Siigo or NIT is incorrect.Solution:Related Code: See
- Verify provider exists in Siigo manually
- Check the NIT format (no dots, dashes, or extra spaces)
- Ensure database returns correct
proveedor_id:
- Check autocomplete timing:
utils/functions.ts:63-77 and utils/transformDs.ts:63Product selection fails or selects wrong product
Product selection fails or selects wrong product
Symptom: Wrong product selected or timeout waiting for product.Cause: Product code doesn’t exist, or autocomplete timing issues.Solution:The scraper uses slow sequential typing to trigger Angular autocomplete:And exact text matching:Verify:
- Product codes match exactly (case-sensitive)
- Products exist in the selected company
- Bodega (warehouse) is available for product
utils/functions.ts:91-126 and utils/transformDs.ts:40Error: Input field not clearing between products
Error: Input field not clearing between products
Symptom: Second product entry fails or previous value remains.Cause: Angular form not resetting after adding item.Solution:The scraper includes explicit wait for input reset:This ensures each product starts with a clean form state.Related Code: See
utils/functions.ts:232-242API and Data Issues
Error: Failed to fetch compra data
Error: Failed to fetch compra data
Symptom: Check CORS configuration if calling from browser.Related Code: See
/scrapping endpoint returns error, no data fetched.Cause: PHP API endpoints unreachable or invalid compra ID.Solution:Test each endpoint manually:api/php.ts:8-76 and server.ts:21-36No products to process (arrays empty)
No products to process (arrays empty)
Symptom: Script completes immediately without creating document.Cause: Products filtered by company resulted in empty arrays.Solution:The data transformation splits products by company:Verify:
- Materials have correct
emp_id_fkin database - At least one product belongs to company 1 or 2
- Material codes exist in Siigo
utils/transformDs.ts:50-60 and main.ts:16-27Browser and Performance Issues
Firefox fails to launch
Firefox fails to launch
Symptom: Error when starting browser.Solution:Install Playwright browsers:Related Code: See
utils/functions.ts:4Script is too slow
Script is too slow
Symptom: Each document takes several minutes.Causes:
- Running with
headless: false(visual mode is slower) - Network latency to Siigo servers
- Retry logic being triggered frequently
- Use headless mode in production:
- Monitor retry logs - frequent retries indicate stability issues
- Optimize network/infrastructure
pressSequentially is intentional to work with Angular:Getting More Help
If your issue isn’t covered here:- Check the Debugging Guide for investigation techniques
- Review server logs for specific error messages
- Run with
headless: falseto visually inspect failures - Check Playwright documentation for selector strategies