Getting - TypeError: Cannot read properties of undefined (reading 'sigBytes')
Closed this issue · 2 comments
We are getting TypeError: Cannot read properties of undefined (reading 'sigBytes') when using this package. The issue is orginating from crypto-js module used inside buckaroo npm package. Please find the initialization and payment creation code below
Initialization ---------
const buckaroo = Buckaroo.InitializeClient({
secretKey: process.env.BUCKAROO_SECRET_KEY,
websiteKey: process.env.BUCKAROO_WEBSITE_KEY,
});
buckaroo.config = {
mode: process.env.NODE_ENV === 'production' ? 'LIVE' : 'TEST',
currency: 'EUR',
returnURL: '',
pushURL: '',
returnURLCancel: '',
continueOnIncomplete: 1,
};
payment code -----------
const payment = await buckarooClient
.method(paymentMethod || null)
.pay({
amountDebit: amount,
invoice: `INV-${moment().year()}-${moment().month() + 1}-${moment().valueOf()}`,
continueOnIncomplete: 1,
returnURL: `${process.env.APP_URL}/v1/record-transaction?paymentId=${paymentId}&transactionId=${transactionId}&userId=${userId}`,
startRecurrent: paymentMode === 'automatic',
})
.request();
Hi @baratkumar,
We use the crypto-js
package for encryption and hashing of data. The error you're encountering suggests that the SDK is receiving undefined values when attempting to create a hash. It appears that the website key
and/or secret key
values are being sent as undefined when the Buckaroo instance is initialized. Please verify that these values are correctly set in the .env
file.
Let me know if you encounter any other issues after this, and if the problem is resolved.
Thanks.