gruhn / vue-qrcode-reader

A set of Vue.js components for detecting and decoding QR codes.
https://gruhn.github.io/vue-qrcode-reader
MIT License
2.03k stars 330 forks source link

ERROR Failed to execute 'detect' on 'BarcodeDetector': Barcode detection service unavailable. DOMException@ er@ @ #432

Closed KarryCMT closed 1 month ago

KarryCMT commented 1 month ago

Describe the bug I used the mobile Edge browser to scan the code normally in the development, and the latest Google Chrome browser to scan the code reported an error. Source code and screenshots have been uploaded

To Reproduce

Source code

code.zip Screenshots image

gruhn commented 1 month ago

@Sec-ant do you think that comes from barcode-detector somewhere?

Sec-ant commented 1 month ago

The error message comes from here: https://github.com/Sec-ant/barcode-detector/blob/fef9ee4fe1868bbe3fdc2983fe452863322ed732/src/BarcodeDetector.ts#L131-L135, I wonder if you can check if there're error messages logged in the dev tools console?

KarryCMT commented 1 month ago

@Sec-ant This is the error log available to me so far, there is no more information to refer to. image image

This is all the dependencies configured for the project "dependencies": { "core-js": "^3.8.3", "vue": "^2.6.14", "vue-qrcode-reader": "^3.2.0", "vue-router": "^3.6.5" }, "devDependencies": { "@babel/core": "^7.12.16", "@vue/cli-plugin-babel": "~5.0.0", "@vue/cli-service": "~5.0.0", "sass": "^1.26.5", "sass-loader": "^8.0.2", "vconsole": "^3.14.6", "vue-template-compiler": "^2.6.14" },

KarryCMT commented 1 month ago

I also had this problem when I tested the scan code on another Android 13 phone,Don't you see how this is related to browser compatibility? image image image

Sec-ant commented 1 month ago

The Type Error - Load failed and Failed to Fetch both suggest the same cause: The WASM binary cannot be successfully fetched. Would you check the network panel and see if there're failing requests to the zxing_reader.wasm file? And there should be a reason why the requests failed.

KarryCMT commented 1 month ago

@Sec-ant This is operated on the mobile terminal of the mobile phone, it seems that you cannot view the relevant content of zxing_reader.wasm, right?

Sec-ant commented 1 month ago

@Sec-ant This is operated on the mobile terminal of the mobile phone, it seems that you cannot view the relevant content of zxing_reader.wasm, right?

The content of zxing_reader.wasm is irrelevant here. What I want to say is that when the component is loaded, it has to fetch the zxing_reader.wasm binary to instantiate the barcode detection module. And from the errors you provided, it seems that the fetch request failed. So I was asking whether you could check the failed requests in the "network" panel in the dev tools? And that may provide us some useful info on why the requests failed.

KarryCMT commented 1 month ago

@Sec-ant There is loading zxing_reader.wasm,But still reported an error, is it possible that the request status is wrong, I am on the local LAN access image

KarryCMT commented 1 month ago

@Sec-ant I tried to use IOS Safari browser and IOS Google Chrome browser, but I couldn't request to get this zxing_reader.wasm file, and an error was reported after the request failed, but Edge browser can get it normally, I don't know what caused it.

KarryCMT commented 1 month ago

I know the problem. It's my network

Sec-ant commented 1 month ago

If you're on a local network and would like to use this component, you'll have to host the zxing_reader.wasm file on your own server. You can find related info here, or in the repos of barcode-detector and zxing-wasm.