$w ( “#vectorImage13” ). src = qr ; //LINE WITH ERROR MESSAGE
ERROR MESSAGE
Wix code SDK error: The “src” property cannot be set to “[object Object]”. It must be a valid SVG XML string or an SVG source starting with “http://”, “https://”, or "wix:vect
BACKEND CODE
// qrCode.jsw
import QRcode from 'qr';
export function generateQRcode(toEncode) {
let opts = {
errorCorrectionLevel: 'H',
type: 'svg',
rendererOpts: {
quality: 0.3
}
};
return QRcode.toString(toEncode, opts, function (err, string) {
if (err) throw err;
return string;
})
}
CLIENT SIDE CODE
import {generateQRcode} from 'backend/qrCode.jsw';
let codeToEncode = "MY-CODE"; //use your own code
//---------------------------------GENERATE QR
generateQRcode(codeToEncode)
.then(qr => {
$w("#vectorImage13").src = qr; //LINE WITH ERROR MESSAGE
console.log("QR IS", qr);
console.log("QR IS", qr);
console.log("QR IS", qr);
})
If that is the problem, I would have to appologize for my lack of knowledge. Your code is inside $w . onReady (() => {}., while mine is inside $ w . onReady ( function () {}, which I assumed was the same
I took another look, and there is one difference between your code and mine, perhaps that is the problem
At the backend, while you use import QRCode from ‘qrcode’ ; I am using import QRCode from ‘qr’. That is because I have a “cannot find the module…” error, when I try using “qrcode”
Another thing that might help, when I test my code the $w ( “#vectorImage13” ). src element just dissapears
Not sure if you used the same library from my old post, or used a different one. I see I installed one called qrcode , and the one you installed seems to be called qr .
You will need to follow the documentation of the library you installed ( qr NPM library?) to see how to import and use that library. The docs should have everything you need. Wix is unable provide support for external libraries.
Sorry, I’ve missed your latest post.
It looks like that something got broken with the performance improvement rollout.
I’ll pass it to someone at Wix, but please prepare a regular page for example that doesn’t require registration and post the link here, so it will be easier to look into it.
Another point that maybe can solve the issue.
It looks like you put an image as placeholder instead of a shape.
Please try to use a shape and let us know if it works.
Hi Sebas,
Is the issue resolved now? I excluded your site from our performance rollout. We will investigate the issue and add your site back in when it’s fixed. Thanks!
Today I saw qrcode issue was fixed. I thank you for that. Great support.
However, about an hour ago, I started having heavy issues, and I can’t work because I have two error messages. I just posted it…
Maybe it is something that has been changed…please let me know
As for the rollout, I would really ask you to include me ASAP to any performance improvement. I am a beginner in coding, so I need every performance help I can get
Your site has been added back into the rollout, which should resolve the new errors. We will continue to investigate the original issue with the QR code. Thanks!