So, I am trying to use Veriff with Next.js, everything works fine in development mode, but it returns error in production mode.
Here is the sample code how I am using it.
useEffect(() => {
if (typeof window != "undefined" && email) {
import("@veriff/js-sdk").then(({ Veriff }: any) => {
const veriff = Veriff(
{
apiKey: process.env.NEXT_PUBLIC_VERIFF_API_KEY,
parentId: "veriff-root",
onSession: function (err: any, response: any) {
console.log("response", response);
verifyUser({
verificationId: response.verification.id,
veriffUrl: response.verification.url,
});
(window as any).veriffSDK.createVeriffFrame({
url: response.verification.url,
onEvent: function (msg: any) {
console.log("msg", msg);
},
});
},
},
{}
);
veriff.setParams({
person: {
givenName: "",
lastName: "",
},
vendorData: me?.email,
});
veriff.mount({
formLabel: {
givenName: "First name",
lastName: "Last Name",
vendorData: "Email",
},
loadingText: "Please wait...",
});
});
}
}, [email]);
Everything is fine in development mode, but in the production mode, I get this error:
8.2caa692da605de2f.js:1 Uncaught ReferenceError: t is not defined
at n.onsubmit (398.2caa692da605de2f.js:1:6839)
n
To me it seems like something is getting conflict with build, since in npm it's publishes only the build. But I am not sure, any help would be appreciated.
So, I am trying to use Veriff with Next.js, everything works fine in development mode, but it returns error in production mode.
Here is the sample code how I am using it.
Everything is fine in development mode, but in the production mode, I get this error:
To me it seems like something is getting conflict with build, since in npm it's publishes only the build. But I am not sure, any help would be appreciated.