pwa-studio
pwa-studio copied to clipboard
[bug]: PWA content security policy restricting camera to scan the barcode.
I need barcode functionality in my PWA instance. So I have taken quaggajs library and implemented the code. But I am getting below errors on console after giving permission to camera on browser.
61.22b88ce37246476835f9.js:240 Refused to create a worker from 'blob:[project url/6054352f-e2f0-49cb-9588-80fcbc7dca81']({project url}/6054352f-e2f0-49cb-9588-80fcbc7dca81%27) because it violates the following Content Security Policy directive: "child-src 'self'". Note that 'worker-src' was not explicitly set, so 'child-src' is used as a fallback.
Can any one help me on this with solution. To reproduce
1)Taken Magento 2.4.6 P1 instance 2)Add quagga library with yarn add quagga 3)Implement the view and code for quagga intialization. 4)Access the url and give camera permission and check the console.
Expected behavior
After giving camera permission no errors should be there on console and we need to scan the barcode.
Added code below which I implemented for barcode functionality.
BarcodeScanner.js
AddBarcodeScannerPage.js for view.
Please let us know what packages this bug is in regards to:
- [ ]
venia-concept
- [ ]
venia-ui
- [ ]
pwa-buildpack
- [ ]
peregrine
- [ ]
pwa-devdocs
- [ ]
upward-js
- [ ]
upward-spec
- [ ]
create-pwa
Hi @prajeswari. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel.
As this is an issue with the third-party module Quagga, hence we are inviting community contribution to it.