Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: PWA content security policy restricting camera to scan the barcode. #4167

Open
8 tasks
prajeswari opened this issue Sep 19, 2023 · 2 comments
Open
8 tasks
Labels
bug Something isn't working

Comments

@prajeswari
Copy link

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.

image

Added code below which I implemented for barcode functionality.
BarcodeScanner.js
image
AddBarcodeScannerPage.js for view.
image

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
@prajeswari prajeswari added the bug Something isn't working label Sep 19, 2023
@m2-assistant
Copy link

m2-assistant bot commented Sep 19, 2023

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.

@glo80771
Copy link
Contributor

As this is an issue with the third-party module Quagga, hence we are inviting community contribution to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants