This guide helps you diagnose and resolve common issues when integrating and using the FAD SDK. Each section includes the problem description, possible causes, and step-by-step solutions.
Problem:Uncaught SyntaxError: Cannot use import statement outside a moduleCause: Missing type="module" attribute in script tag.Solution:Add type="module" to your script tag:
ES6 modules require a server environment. Opening HTML files directly with file:// protocol will fail due to CORS restrictions.
CORS error when loading SDK files
Problem:Access to script at 'file://...' from origin 'null' has been blocked by CORS policyCause: Attempting to load ES6 modules using file:// protocol.Solution:Use a local development server:
# Install Live Server extension# Right-click HTML file → "Open with Live Server"
SDK initialization fails immediately
Problem: SDK constructor throws an error or returns undefined.Possible Causes:
Invalid or expired authentication token
Incorrect environment configuration
Network connectivity issues
Solution:
Verify token is valid and not expired:
console.log('Token:', TOKEN); // Should not be empty
Check environment configuration:
const options = { environment: FadSDK.getFadEnvironments().UATHA, // or PRODUCTION};console.log('Environment:', options.environment);
catch (ex) { if (ex.code === FadSDK.Errors.Facetec.Session.CAMERA_NOT_RUNNING) { alert('Camera not available. Please:\n' + '1. Grant camera permissions\n' + '2. Ensure no other app is using the camera\n' + '3. Try refreshing the page'); }}
For HTTPS requirements: Most browsers require HTTPS to access camera (except for localhost).
Camera permission denied on first load
Problem: Browser blocks camera access without showing permission prompt.Cause: Previous permission denial or browser security settings.Solution:
Clear site permissions in browser:
Chrome: Settings → Privacy → Site Settings → Camera
Firefox: Settings → Privacy → Permissions → Camera
Safari: Settings → Websites → Camera
Implement permission checking:
async function checkCameraPermission() { try { const result = await navigator.permissions.query({ name: 'camera' }); if (result.state === 'denied') { showPermissionHelp(); // Guide user to enable permissions return false; } return true; } catch (err) { // Fallback: Try to request access directly return testCamera(); }}
Camera works on desktop but not mobile
Problem: Camera functions correctly on desktop browsers but fails on mobile devices.Possible Causes:
HTTP instead of HTTPS (required on mobile)
Browser compatibility issues
Mobile OS permissions
Solution:
Use HTTPS: Mobile browsers require HTTPS for camera access
✅ https://your-domain.com✅ https://localhost (development)❌ http://your-domain.com (won't work on mobile)
Problem: Error code ID_PHOTO_NOT_FOUND when capturing identification documents.Cause: Face photo extraction failed from the captured document.Solution:
catch (ex) { if (ex.code === FadSDK.Errors.Regula.ID_PHOTO_NOT_FOUND) { showRetryMessage( 'Could not extract photo from ID. Please:\n' + '• Ensure the photo on ID is clearly visible\n' + '• Improve lighting conditions\n' + '• Avoid shadows or glare on the document' ); }}
Document capture: OCR_NOT_FOUND error
Problem: Error code OCR_NOT_FOUND - OCR data extraction failed.Cause: Text on the document could not be read clearly.Solution:
Verify OCR is enabled:
const idData = true; // Must be true for OCRconst response = await FAD_SDK.startRegula( CREDENTIALS, FadSDK.Constants.Regula.CaptureType.CAMERA_SNAPSHOT, idData, // Enable OCR extraction true, CONFIGURATION);
Improve capture quality:
Better lighting (avoid shadows)
Higher resolution camera
Hold camera steady
Ensure text is in focus
Clean the camera lens
User guidance:
catch (ex) { if (ex.code === FadSDK.Errors.Regula.OCR_NOT_FOUND) { showCaptureGuide({ title: 'Document Not Clear', instructions: [ 'Hold the device steady', 'Ensure good lighting', 'Keep text sharp and readable', 'Avoid glare and shadows' ] }); }}
Problem:WebAssembly.instantiate(): Compiling function failedCause: Browser doesn’t support WebAssembly or WASM features used by SDK.Solution:
Check WebAssembly support:
if (typeof WebAssembly !== 'object') { alert('Your browser does not support WebAssembly.\n' + 'Please update your browser or use a modern browser.'); return;}