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

Issue embedding Daily-js in Chrome Extension Manifest v3 -- Refused to load the script 'https://c.daily.co/call-machine/versioned/0.70.0/static/call-machine-object-bundle.js' #254

Open
abhagi opened this issue Aug 31, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@abhagi
Copy link

abhagi commented Aug 31, 2024

Error Message

Refused to load the script 'https://c.daily.co/call-machine/versioned/0.70.0/static/call-machine-object-bundle.js' because it violates the following Content Security Policy directive

Additional Context

I am trying to embed a Daily.co audio/video/screenshare call within a Chrome Extension manifest version 3, using daily-js.
I am using custom call object approach instead of Prebuilt UI approach, because i need to be able to customize app UI / functionality / layout management.

I initially tried DailyIframe.createCallObject(), which failed with an error message that this call requires 'unsafe-eval' and that is disallowed by the Content Security Policy within the extension.

I then followed the instructions on this Guide by the Daily-js team:
https://docs.daily.co/guides/privacy-and-security/content-security-policy

The guide suggests avoiding unsafe-eval by creating the call object like this:

const call = Daily.createCallObject({
  dailyConfig: {
    avoidEval: true,
  },
});

However this still requires adding a script-src directive to the Content Security Policy, with the URL 'https://*.daily.co'.
And it appears that providing any URL here other than 'self' is not allowed in Chrome Extensions manifest v3.

Attempting this produces the error message i have shared above.

How can I get daily-js to work within a chrome extension?

Is it possible, for example, to bundle all required resources (like 'call-machine-object-bundle.js') within the extension and avoid all dynamic loading completely?

Related Past Issues

#166
User @nalhusail asked a similar question back in 2021, but the issue was closed before a response or resolution was provided. I would imagine that three years later, either the Daily team or the community has discovered a workaround. Would love some help with this!

@abhagi abhagi added the bug Something isn't working label Aug 31, 2024
@vr000m
Copy link

vr000m commented Sep 6, 2024

@abhagi

according to the developer that made a proof of concept Manifest v3 extension, the workaround was to download the call-machine bundle.

{ "name": "daily-chrome-extension", "description": "Daily Chrome extension to connect to Daily meetings.", "version": "0.0.1", "manifest_version": 3, "minimum_chrome_version": "116", "background": { "service_worker": "serviceWorker.js" }, "permissions": ["scripting", "tabs", "activeTab", "tabCapture", "offscreen"], "host_permissions": [ "https://*/*", "http://localhost:*/*" ], "web_accessible_resources": [ { "resources": ["call-machine-object-bundle-v0.67.0.js"], "matches": [ "https://*/*", "http://localhost:*/*" ] } ], "action": { "default_title": "Daily extension", "default_popup": "popup.html", "default_icon": { "16": "/icons/16x.png", "32": "/icons/32x.png", "48": "/icons/48x.png", "128": "/icons/128x.png" } }, "icons": { "16": "/icons/16x.png", "32": "/icons/32x.png", "48": "/icons/48x.png", "128": "/icons/128x.png" } }

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