Troubleshooting Guide
Troubleshooting Guide
Common issues and solutions for Bloqr Compiler.
Table of Contents
- Installation Issues
- Compilation Errors
- Performance Issues
- Network & API Issues
- Cache Issues
- Deployment Issues
- Platform-Specific Issues
Installation Issues
Package not found on JSR
Error:
error: JSR package not found: @jk-com/bloqr-compilerSolution: Use npm import as fallback:
import { compile } from 'npm:@jk-com/bloqr-compiler';Or install via npm:
npm install @jk-com/bloqr-compilerDeno version incompatibility
Error:
error: Unsupported Deno versionSolution: Bloqr Compiler requires Deno 2.0 or higher:
deno upgradedeno --version # Should be 2.0.0 or higherPermission denied errors
Error:
error: Requires net access to "example.com"Solution: Grant necessary permissions:
# Allow all network accessdeno run --allow-net your-script.ts
# Allow specific hostsdeno run --allow-net=example.com,github.com your-script.ts
# For file accessdeno run --allow-read --allow-net your-script.tsCompilation Errors
Invalid configuration
Error:
ValidationError: Invalid configuration: sources is requiredSolution: Ensure your configuration has required fields:
const config: IConfiguration = { name: 'My Filter List', // REQUIRED sources: [ // REQUIRED { name: 'Source 1', source: 'https://example.com/list.txt', }, ], // Optional fields...};Source fetch failures
Error:
Error fetching source: 404 Not FoundSolutions:
- Check URL validity:
// Verify the URL is accessibleconst response = await fetch(sourceUrl);console.log(response.status); // Should be 200- Handle 404s gracefully:
// Use exclusions_sources to skip broken sourcesconst config = { name: 'My List', sources: [ { name: 'Good', source: 'https://good.com/list.txt' }, { name: 'Broken', source: 'https://broken.com/404.txt' }, ], exclusions_sources: ['https://broken.com/404.txt'],};- Check circuit breaker:
Source temporarily disabled due to repeated failuresWait 5 minutes for circuit breaker to reset, or check the source availability.
Transformation errors
Error:
TransformationError: Invalid rule at line 42Solution: Enable validation transformation to see detailed errors:
const config = { name: "My List", sources: [...], transformations: [ "Validate", // Add this to see validation details "RemoveComments", "Deduplicate" ]};Memory issues
Error:
JavaScript heap out of memorySolutions:
- Increase memory limit (Node.js):
node --max-old-space-size=4096 your-script.js- Use streaming for large files:
// Process sources in chunksconst config = { sources: smallBatch, // Process 10-20 sources at a time transformations: ['Compress', 'Deduplicate'],};- Enable compression:
transformations: ['Compress']; // Reduces memory usagePerformance Issues
Slow compilation
Symptoms:
- Compilation takes >60 seconds
- High CPU usage
- Unresponsive UI
Solutions:
- Enable caching (API/Worker):
// Cloudflare Worker automatically caches// Check cache headers:X-Cache-Status: HIT- Use batch API for multiple lists:
// Compile in parallelPOST /compile/batch{ "requests": [ { "id": "list1", "configuration": {...} }, { "id": "list2", "configuration": {...} } ]}- Optimize transformations:
// Minimal transformations for speedtransformations: [ 'RemoveComments', 'Deduplicate', 'RemoveEmptyLines',];
// Remove expensive transformations like:// - Validate (checks every rule)// - ConvertToAscii (processes every character)- Check source count:
// Limit to 20-30 sources max// Too many sources = slow compilationconsole.log(config.sources.length);High memory usage
Solution:
// Use Compress transformationtransformations: ['Compress', 'Deduplicate'];
// This reduces memory usage by 70-80%Request deduplication not working
Issue: Multiple identical requests all compile instead of using cached result.
Solution: Ensure requests are identical:
// These are DIFFERENT requests (different order)const req1 = { sources: [a, b] };const req2 = { sources: [b, a] };
// These are IDENTICAL (will be deduplicated)const req1 = { sources: [a, b] };const req2 = { sources: [a, b] };Check for deduplication:
X-Request-Deduplication: HITNetwork & API Issues
Rate limiting
Error:
429 Too Many RequestsRetry-After: 60Solution: Respect rate limits:
const retryAfter = response.headers.get('Retry-After');await new Promise((resolve) => setTimeout(resolve, retryAfter * 1000));Rate limits:
- Per IP: 60 requests/minute
- Per endpoint: 100 requests/minute
CORS errors
Error:
Access to fetch at 'https://...' from origin 'https://...' has been blocked by CORSSolution: Use the API endpoint which has CORS enabled:
// ✅ CORRECT - CORS enabledfetch('https://bloqr-backend.jk-com.workers.dev/compile', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ configuration }),});
// ❌ WRONG - Direct source fetch (no CORS)fetch('https://random-site.com/list.txt');Timeout errors
Error:
TimeoutError: Request timed out after 30000msSolution:
- Check source availability:
curl -I https://source-url.com/list.txt- Circuit breaker will retry:
- Automatic retry with exponential backoff
- Up to 3 attempts
- Then source is temporarily disabled
- Use fallback sources:
sources: [ { name: 'Primary', source: 'https://primary.com/list.txt' }, { name: 'Mirror', source: 'https://mirror.com/list.txt' }, // Fallback];SSL/TLS errors
Error:
error: Invalid certificateSolution:
# Deno - use --unsafely-ignore-certificate-errors (not recommended)deno run --unsafely-ignore-certificate-errors script.ts
# Better: Fix the source's SSL certificate# Or use HTTP if available (less secure)Cache Issues
Stale cache
Issue: API returns old/outdated results.
Solution:
- Check cache age:
const response = await fetch('/compile', {...});console.log(response.headers.get('X-Cache-Age')); // Seconds- Force cache refresh: Add a unique parameter:
const config = { name: "My List", version: new Date().toISOString(), // Forces new cache key sources: [...]};- Cache TTL:
- Default: 1 hour
- Max: 24 hours
Cache miss rate high
Issue:
X-Cache-Status: MISSMost requests miss cache.
Solution: Use consistent configuration:
// BAD - timestamp changes every timeconst config = { name: "My List", version: Date.now().toString(), // Always different! sources: [...]};
// GOOD - stable configurationconst config = { name: "My List", version: "1.0.0", // Static version sources: [...]};Compressed cache errors
Error:
DecompressionError: Invalid compressed dataSolution: Clear cache and recompile:
// Cache will be automatically rebuilt// If persistent, file a GitHub issueDeployment Issues
deno: not found error during deployment
Error:
Executing user deploy command: deno deploy/bin/sh: 1: deno: not foundFailed: error occurred while running deploy commandCause:
This error occurs when Cloudflare Pages is configured with deno deploy as the deploy command. This project uses Cloudflare Workers (not Deno Deploy) and should use wrangler deploy instead.
Solution: Update your Cloudflare Pages dashboard configuration:
- Go to your Pages project settings
- Navigate to “Builds & deployments”
- Under “Build configuration”:
- Set Build command to:
npm install - Set Deploy command to: (leave empty)
- Set Build output directory to:
public - Set Root directory to: (leave empty)
- Set Build command to:
- Save changes and redeploy
For detailed instructions, see the Cloudflare Pages Deployment Guide.
Why this happens:
- This is a Deno-based project, but it deploys to Cloudflare Workers, not Deno Deploy
- The build environment has Node.js/pnpm but not Deno installed
- Wrangler handles the deployment automatically
Cloudflare Worker deployment fails
Error:
Error: Worker exceeded memory limitSolutions:
- Check bundle size:
du -h dist/worker.js# Should be < 1MB- Minify code:
deno bundle --minify src/worker.ts dist/worker.js- Remove unused imports:
// BADimport * as everything from '@jk-com/bloqr-compiler';
// GOODimport { compile, FilterCompiler } from '@jk-com/bloqr-compiler';Worker KV errors
Error:
KV namespace not foundSolution: Ensure KV namespace is bound in wrangler.toml:
[[kv_namespaces]]binding = "CACHE"id = "your-kv-namespace-id"Create namespace:
wrangler kv:namespace create CACHEEnvironment variables not set
Error:
ReferenceError: CACHE is not definedSolution: Add bindings in wrangler.toml:
[env.production]vars = { ENVIRONMENT = "production" }
[[env.production.kv_namespaces]]binding = "CACHE"id = "production-kv-id"Platform-Specific Issues
Deno issues
Issue: Import map not working
Solution:
# Use deno.json, not import_map.json# Ensure deno.json is in project rootIssue: Type errors
Solution:
# Clear Deno cacherm -rf ~/.cache/denodeno cache --reload src/main.tsNode.js issues
Issue: ES modules not supported
Solution: Add to package.json:
{ "type": "module"}Or use .mjs extension:
mv index.js index.mjsIssue: CommonJS require() not working
Solution:
// Use dynamic importconst { compile } = await import('@jk-com/bloqr-compiler');
// Or convert to ES modulesBrowser issues
Issue: Module not found
Solution: Use a bundler (esbuild, webpack):
npm install -D esbuildnpx esbuild src/main.ts --bundle --outfile=dist/bundle.jsIssue: CORS with local files
Solution: Run a local server:
# Pythonpython -m http.server 8000
# Denodeno run --allow-net --allow-read https://deno.land/std/http/file_server.ts
# Nodenpx serve .Getting Help
Enable debug logging
// Set environment variableDeno.env.set('DEBUG', 'true');
// Or in .env fileDEBUG = true;Collect diagnostics
# System infodeno --versionnode --version
# Network testcurl -I https://bloqr-backend.jk-com.workers.dev/api
# Permissions testdeno run --allow-net test.tsReport an issue
Include:
- Error message (full stack trace)
- Minimal reproduction code
- Configuration file (sanitized)
- Platform/version info
- Steps to reproduce
GitHub Issues: https://github.com/jaypatrick/bloqr-compiler/issues
Community support
- Documentation: README.md
- API Reference: docs/api/README.md
- Examples: docs/guides/clients.md
- Web UI: https://bloqr-backend.jk-com.workers.dev/
Quick Fixes Checklist
- Updated to latest version?
- Cleared cache? (
rm -rf ~/.cache/denoorrm -rf node_modules) - Correct permissions? (
--allow-net --allow-read) - Valid configuration? (name + sources required)
- Network connectivity? (
curl -I <source-url>) - Rate limits respected? (60 req/min)
- Checked GitHub issues? (Someone may have solved it)
Still stuck? Open an issue with full details!