How to solve this error --> Error during the initialization of the SDK! DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope'

Viewed 134

I am working on a React project, in that I am implementing Microblink https://www.npmjs.com/package/@microblink/blinkcard-in-browser-sdk npm for scanning credit cards but when I run the project it is showing this kind of error Error during the initialization of the SDK! DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope'

Please help to resolve this issue.

This is my code

import React from 'react';
import * as BlinkCardSDK from "@microblink/blinkcard-in-browser-sdk";
import './App.css';


const App = () => {
  if (BlinkCardSDK.isBrowserSupported()) {
    const loadSettings = new BlinkCardSDK.WasmSDKLoadSettings("sRwAAAYJbG9jYWxob3N0r/lOPmg/w35CpOHWK+o8YBgy/pGDcaB7TnbwT8mPpSzcCTWnV/AEyEIWVrcjyzdUSYb2bT0ccHxN4WDKrHoxoLQKBeq+ZukLOK13VwZXeikV4ggv2wrrW162/GIO5hajgqiEATKco+QfglS+OwguBweuacsuRR8UCD/YTdg4ysGMVljN7IIrthHPnmUa0SBOoeReXYvGmrKkVztIZzu9qkZoHu0UwCTN9Xloxa9Srw==");

    BlinkCardSDK.loadWasmModule(loadSettings).then
      (
        (wasmSDK: BlinkCardSDK.WasmSDK) => {
        },
        (error: any) => {
          // console.log('test')
          console.log("Error during the initialization of the SDK!", error);
          // console.log('testnew')
        }
      )
  }
  else {
    console.log("This browser is not supported by the SDK!");
  }
  return (
    <div>
    </div>
  )
}



export default App

If you have any questions please let me know.

1 Answers

Besides the license key, you also need to set the proper absolute path to the actual wasm and js support files of the SDK, a.k.a the engineLocation. The resource files need to be hosted somewhere accessible to the app.

There's a more detailed explanation of the SDK configuration in the documentation

Quick side note: it's probably not recommended to share your license key publicly, even if it's just a trial key.

Related