Closed oxidia closed 2 years ago
cjs
esm
const { FaceSdk } = require("@regulaforensics/facesdk-webclient"); async function match() { try { const sdk = new FaceSdk({ basePath: process.env.REGULA_FACE_API_BASE_URL }); const face1 = fs.readFileSync("face1.jpg").buffer; const face2 = fs.readFileSync("face2.jpg").buffer; const response = await sdk.matchingApi.match({ images: [{ data: face1 }, { data: face2 }] }); console.log(response); } catch (error) { console.log(error); } }
TypeError: Cannot read property 'encode' of undefined at MatchingApi.match (/home/node/app/node_modules/@regulaforensics/facesdk-webclient/dist/cjs-es5/ext/matching-api.js:33:59)
It works with this change!!
filename: node_modules/@regulaforensics/facesdk-webclient/dist/cjs-es5/ext/matching-api.js line: 33
node_modules/@regulaforensics/facesdk-webclient/dist/cjs-es5/ext/matching-api.js
33
- image.data = base64_arraybuffer_1.default.encode(image.data); + image.data = base64_arraybuffer_1.encode(image.data);
https://github.com/regulaforensics/FaceSDK-web-js-client/pull/28 fixed in scope of this PR with your changes
Expected behavior
Current behavior
NB
cjs
, but withesm
it works just fine!Code sample
Stack trace
Trying to figure out the issue
It works with this change!!
filename:
node_modules/@regulaforensics/facesdk-webclient/dist/cjs-es5/ext/matching-api.js
line:33